Hi
It's a regression. Since 2.1.2, thread local proxies are used when the field or setter method injection is required, and as part of
that work the @Resource filed injection got broken. I've got it fixed with a test in my snapshot - but it'll only be available
shortly in 2.1.3-SNAPSHOT.
In meantime - please change @Resource to @Context and it will work fine. Supporting @Resource is still optional AFAIK and I was not
paying good attention to it... Sorry about it
By the way - I can see you're using a CXF interceptor in your configuration - what stage your custom interceptor sits in - we'll
need to update the JAXRSInInterceptor's phase a bit so we need to be careful not to break some existing interceptors...
Cheers, Sergey
I just did an upgrade to cxf 2.1.2 and my injection is not working now. I
can't figure out
my beans.xml and sample code is below
<?xml version=*"1.0"* encoding=*"UTF-8"*?>
<beans xmlns=*"http://www.springframework.org/schema/beans"*
xmlns:xsi=*"http://www.w3.org/2001/XMLSchema-instance"*
xmlns:jaxrs=*"http://cxf.apache.org/jaxrs"*
xmlns:cxf=*"http://cxf.apache.org/core"*
xsi:schemaLocation=*"
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"*>
<import resource=*"classpath:META-INF/cxf/cxf.xml"* />
<import resource=*"classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"*
/>
<import resource=*"classpath:META-INF/cxf/cxf-servlet.xml"* />
<jaxrs:server id=*"documentQ"* address=*"/"*>
<jaxrs:serviceBeans>
<ref bean=*"docQService"*/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class=*"org.gg.providers.MapProvider"* />
</jaxrs:providers>
<jaxrs:inInterceptors>
<bean class=*"org.gg.interceptors.SessionInterceptor"* />
</jaxrs:inInterceptors>
<jaxrs:features><cxf:logging /></jaxrs:features>
</jaxrs:server>
<bean id=*"docQService"* class=*"org.gg.services.LoginService"*></bean>
</beans>
and my sample code
*/
@Path("/Login")
*
public* *class* LoginService
{
*private* *static* *final* Logger *logger* = Logger.*getLogger*
(LoginService.*class*);
@Resource HttpServletRequest request;
@Resource HttpServletResponse response;
@Resource ServletContext servletContext;
@POST
@Path("/authenticate")
//@ConsumeMime("application/x-*www*-form-*urlencoded*")
@ConsumeMime("*/*")
*public* Response login(MultivaluedMap<String, String> parameters)
{
String userID = *null*;
*if* (request.getSession().getAttribute("employee") == *null*) {
my request here is coming null