spring - Inject HTTPServletRequest into a request scoped bean -
i have rest api webservice injects singleton bean. bean needs know httpservletrequest. have created bean called requestserviceimpl has httpservlerrequest injected.
public class requestserviceimpl implements requestservice { @autowired private httpservletrequest request; }
web-context contains bean definition
<bean id="requestservice" class="com.requestserviceimpl" scope="request"> <aop:scoped-proxy/> </bean>
this requestservice injected singleton bean. see requestservice bean being injected correctly httpservletrequest object null. not sure going wrong
httpservletrequest interface. cannot have instance of interface. may inject class implements httpservletrequest
, httpservletrequestwrapper. have reference implementation if want.
this answer further.. spring dependency injection interfaces
Comments
Post a Comment