users@jersey.java.net

Jersey 0.6 and Spring

From: Tom Davies <tgdavies_at_gmail.com>
Date: Tue, 19 Feb 2008 15:36:20 +1100

Hi,

I'm trying to follow these instructions http://blogs.sun.com/sandoz/entry/integrating_jersey_and_spring_take
  for using Jersey and Spring.

I'm finding that my Spring bean is not getting picked up by the
ComponentProvider.

I'm suffering from a complete lack of understanding as to how the
ComponentProvider works: looking in the debugger I see that the
component provider is asked for beans implementing any of class
com.sun.ws.rest.impl.provider.entity.StringProvider, class
com.sun.ws.rest.impl.provider.entity.ByteArrayProvider, class
com.sun.ws.rest.impl.provider.entity.FileProvider, class
com.sun.ws.rest.impl.provider.entity.InputStreamProvider, class
com.sun.ws.rest.impl.provider.entity.DataSourceProvider, class
com.sun.ws.rest.impl.provider.entity.MimeMultipartProvider, class
com.sun.ws.rest.impl.provider.entity.FormURLEncodedProvider, class
com.sun.ws.rest.impl.provider.entity.XMLJAXBElementProvider.

My bean class looks like:

@Path("/review")
@Singleton
public class RestReviewService {
     @Autowired
     private ReviewService reviewService;

     @GET
     @Path("reviews")
     @ProduceMime("text/plain")
     public List<ReviewData> getAllReviews() {
         return reviewService.getAllReviews();
     }
}


and its spring declaration like:
     <bean id="restReviewService"
class="com.atlassian.crucible.spi.rpc.RestReviewService"
scope="singleton" autowire="autodetect"/>

so I don't think it is going to implement any of those interfaces, and
so won't be seen.

Can someone help to clear up my misconceptions?

Thanks,
   Tom