How to make Jersey 2 / Spring 4 load beans from @Configuration on a no web.xml configuration
<p>For the sake of learning (Spring Boot is great and magic..), I am trying to set up a web app using Jersey and Spring (for DI). I have managed to get it working but only with Spring xml configuration.</p>

<p>I have extended ResourceConfig</p>

<pre><code>@ApplicationPath("/api")
public class JerseyWebApp extends ResourceConfig {

  public JerseyWebApp() {
      packages("com.company.controller");
  }
} 
</code></pre>

<p>My HelloController.java</p>

<pre><code>@Path("/hello")
public class HelloController {

  private HelloService helloService;

  @Autowired
  public HelloController(HelloService helloService) {
      this.helloService = helloService;
  }

  @GET
  public String hello() {
      return helloService.sayHello();
  }
}
</code></pre>

<p>my HelloService.java</p>

<pre><code>@Component
@Scope(value = BeanDefinition.SCOPE_PROTOTYPE)
public class HelloService {

  public String sayHello() {
    return "hello from jersey webapp";
  }
}
</code></pre>

<p>and my spring applicationContext.xml</p>

<pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt;

&lt;context:component-scan base-package="com.company" /&gt;
&lt;/beans&gt;
</code></pre>

<p>Also attaching my pom file</p>

<pre><code>&lt;properties&gt;
    &lt;jersey2.version&gt;2.23.2&lt;/jersey2.version&gt;
    &lt;jaxrs.version&gt;2.0.1&lt;/jaxrs.version&gt;
    &lt;spring.version&gt;4.3.2.RELEASE&lt;/spring.version&gt;
&lt;/properties&gt;

&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
        &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
        &lt;version&gt;${jersey2.version}&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;org.glassfish.jersey.ext&lt;/groupId&gt;
        &lt;artifactId&gt;jersey-spring3&lt;/artifactId&gt;
        &lt;version&gt;${jersey2.version}&lt;/version&gt;
        &lt;exclusions&gt;
            &lt;exclusion&gt;
                &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
                &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;/exclusion&gt;
            &lt;exclusion&gt;
                &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
                &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;/exclusion&gt;
            &lt;exclusion&gt;
                &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
                &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;/exclusion&gt;
            &lt;exclusion&gt;
                &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
                &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;/exclusion&gt;
            &lt;exclusion&gt;
                &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
                &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
            &lt;/exclusion&gt;
            &lt;exclusion&gt;
                &lt;artifactId&gt;
                    jersey-container-servlet-core
                &lt;/artifactId&gt;
                &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
            &lt;/exclusion&gt;
            &lt;exclusion&gt;
                &lt;artifactId&gt;hk2&lt;/artifactId&gt;
                &lt;groupId&gt;org.glassfish.hk2&lt;/groupId&gt;
            &lt;/exclusion&gt;
        &lt;/exclusions&gt;
    &lt;/dependency&gt;
    &lt;!--Spring 4--&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
        &lt;version&gt;${spring.version}&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
        &lt;version&gt;${spring.version}&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
        &lt;version&gt;${spring.version}&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
        &lt;version&gt;${spring.version}&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
        &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
        &lt;version&gt;3.0.1&lt;/version&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;
</code></pre>

<p>Is it possible to get Jersey to load beans via a @Configuration class or shall I consider using Spring web/mvc to bootstrap the whole application.</p>