- Spring 5.0 Cookbook
- Sherwin John Calleja Tragura
- 73字
- 2021-07-08 10:16:24
Creating request- and session-scoped beans
Chapter 2, Learning Dependency Injection (DI), discussed a recipe about configuring the lifespan of a bean inside the ApplicationContext container based on fetching or getBean(). These are the long-lived singleton and prototype beans. Now, we will discuss configuring the lifespan or scope of some beans which are bounded within MVC web transactions. This recipe will discuss creating short-lived beans that only last during request dispatch and session handling.