How to use Jersey 2 with Spring IoC container

jersey, spring

Solution

You should be able to annotate jersey components and then use annotations to inject the beans.

@Service //(or @Component)
public class MyJerseyService {

    @Autowired
    private MyObj mySpringBean

}

Problem

What is the best way to enable injection of spring beans into Jersey 2? Jersey seems to not support this natively. What is needed to wire the 2 frameworks together? In pom.xml and web.xml?

Original source