title: Autowire annotation in JAX-RS and Spring
body: <p>I am trying to add REST support to my Spring 3 + Hibernate application. </p>
  
  <p>I have created the REST support using the wizard from Netbeans, at it has put a @Autowire annotation (not @autowired) above my Resource class. Getting the @Autowire annotation from Spring causes the error</p>
  
  <pre><code> incompatible types
  found   : org.springframework.beans.factory.annotation.Autowire
  required: java.lang.annotation.Annotation
  </code></pre>
  
  <p>Getting @Autowire from JAX-RS should be only for Spring 2.5 as far as I understand from <a href="http://jersey.java.net/nonav/documentation/latest/chapter_deps.html#d4e1858" rel="nofollow">here</a>. I get the following error if I include it, which I think is related to Spring 2.5 being loaded:</p>
  
  <pre><code>    SEVERE: Exception while loading the app : java.lang.IllegalStateException: 
  ContainerBase.addChild: start: org.apache.catalina.LifecycleException: 
  org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception 
  parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; 
  nested exception is java.lang.NoSuchMethodError: 
  org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/
  Object;)Lorg/springframework/beans/MutablePropertyValues;
  </code></pre>
  
  <p>Could someone point me on how to add this annotation, and make JAX-RS work with Spring? Also, I was using a SessionFactory and the autogenerated code refers to a entityManagerFactory in the applicationcontext. Can those be used interchangingly?</p>
  
  <p>PS: Allow me to say that I hate Java EE with a passion so far in my three week journey with the platform, major stumbling blocks at every level, sorry for the rant.</p>