I’m trying to understand the request scoped beans. Suppose I have a controller and I have a request scoped bean instantiated using spring config xml
<bean id="loginAction" class="com.foo.LoginAction" scope="request"/>
Do I need to add it as a dependency in controller to access it or I can access it directly from request object doing request.getAttribute(“loginAction”)
I just wanted to know how would I access this request scoped bean.
Thanks.
Use
@Autowiredannotation for this case.and then add package for this bean as candidate for autowiring:
and don’t forget to mark this class as
@Componentor@Service.