I'm trying to use Jersey 2 with Spring with help of this article: How to use Jersey 2 with Spring IoC container
But autowired bean is null when the application tries to call it after the client request. In applicationContext.xml i have only component-scan setting.
In pom.xml:
<spring.version>4.1.0.RELEASE</spring.version>
<jersey.version>2.12</jersey.version>
@Component
@RequestScoped
@Path("/user")
public class UserREST {
@Autowired
private UserFacade userFacade;
@POST
@Path("/auth")
@Consumes(MediaType.APPLICATION_JSON)
@Produces({MediaType.APPLICATION_JSON})
public AuthResponse authorize(User user){
return userFacade.authorize(user); // Null is caught here
}
}
-
@Component
public class UserFacade {
public AuthResponse authorize(com.pushock.model.User user){
AuthResponse response = new AuthResponse();
response.setAuthorized(true);
return response;
}
}
What am I doing wrong?
UPD: Here is my pom.xml https://bitbucket.org/spukhov/memo-ws/src/00724e00e3aa786f62fd0e43fe0606de6ae569df/pom.xml?at=master