Postby swyd » Wed Apr 03, 2013 2:56 am
Hi guys, on this subject, since i had the same issue, and solved the same way some time back. I wanted to post my experience, i had another issue with this, Jersey Servlet was scanning all packages on classpath(does this by default), and even when i created an extending class to override the above mentioned one, created a bean to reference, it was still using the original one, so since i wasn't scanning it through spring, i guessed it was Jersey, the way i solved it was i limited the packages that Jersey scan's by configuring the sevlet
<servlet>
<servlet-name>JerseyServlet</servlet-name>
<servlet-class>
com.sun.jersey.spi.spring.container.servlet.SpringServlet
</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>package.name;org.codehaus.jackson.jaxrs;...</param-value>
</init-param>
</servlet>
just list the packages that need to be scanned for jax-rs annotations, and on another note, Jackson (org.codehaus.jackson.jaxrs) is a much better behaved JSON provider, same behaviour on XML, and this is how you tell Jersey to use it. One of the examples is that it doesn't return null but a valid JSON response { }, and forms JSON lists much better.