Jersey: Inject Spring component in ContainerRequestFilter

I am using Jersey 1.4 ea along with Spring 3.0 and integration jersey-spring. Jersey and Spring integration is great for resource classes, as described here . Be that as it may, I want to add the Spring component to the ContainerRequestFilter in order to do some preprocessing of the requests.

@Component
public class SecurityFilter implements ContainerRequestFilter {

    // UserManager is a declared spring component
    // Injecting it should work somehow
    @Autowired
    private UserManager userManager;

    @Override
    public ContainerRequest filter(ContainerRequest request) {
        System.out.println(userManager);
        // prints out null on request
    }
}

Both the filter and the bean user manager are registered when the application is deployed to Glassfish. I wonder what I'm doing wrong. Is there a way to insert a Spring managed bean into a ContainerRequestFilter?

UPDATE

. , Spring beans, beans - Java ( -). Spring - Java-, proxy-target-class="true" Spring. <tx:annotation-driven proxy-target-class="true" />.

.

+5
1

Jersey 1.6 Spring 3.0.5. , , @Component, Spring Jersey :

@Path("/beams")
@Produces("text/xml")
@Component
@Scope("singleton")
public class BeamsResource {
}

- , , . , , -, Jersey Spring. BLEH.

+2

All Articles