users@jersey.java.net

[Jersey] jersey-spring3 with AnnotationConfigWebApplicationContext based applications

From: António Mota <amsmota_at_gmail.com>
Date: Fri, 15 Nov 2013 14:20:09 +0000

Hi all.

I'm upgrading Jersey to 2.4.1 and Spring to 3.2.5 while trying to use the
new features of Servlet 3, namely the XML-less configurations by using
a WebApplicationInitializer with AnnotationConfigWebApplicationContext. I'm
also trying to use jersey-spring3 module.

This is proving hard to do, because jersey-spring3 seems to expect only
WebApplications to be defined in XML. There is the problem with
the SpringWebApplicationInitializer initialization that can be hacked like
here [1] but that leaves me with the problem with
the SpringComponentProvider [2].

Looking at the code

ServletContext sc = locator.getService(ServletContext.class);

I was trying also to add my WebApplicationInitializer's ServletContext to
the HK2 Jersey ServiceLocator, but I couldn't find a way to do it.


Anyone knows how to overcome this problem?

Cheers.


[1] https://java.net/jira/browse/JERSEY-2038
[2]
https://java.net/jira/browse/JERSEY-2038?focusedCommentId=370706&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_370706