users@jersey.java.net

Re: SpringServlet support when Spring is not started from a web context?

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Thu, 2 Dec 2010 12:55:25 +0100

Hi Edwin,

Did you manage to resolve your previous issue you emailed about with
the ServletContext being null ?

Could you please send a maven project that reproduces the issue then i
can investigate.

 From the link you sent it looks you will also need to set explicitly
set the ApplicationContext for the SpringServlet as discussed on the
other related email thread. One way to override the setting of the
context is to do:


public MySpringServlet extends SpringServlet {
    @Override
    protected ConfigurableApplicationContext getContext() { ... }

}

But i agree we require a more Spring aware way of doing this without
having to modify the Jersey code e.g. by setting a property on the
SpringServlet.

Paul.

On Dec 2, 2010, at 1:24 AM, chauzer wrote:

>
> I'm running into the exact same issue here:
>
> I have a spring applicationContext.xml which has configurations for an
> embedded jetty instance, and im trying to pass along the spring-jersey
> servlet into it. I did the same thing as you and overwrote the
> initiate
> method from SpringServlet and passed in the applicationContext that I
> already have. However, in my jersey resource classes, i want the
> scope to be
> request (rather than singletons), but i'm receiving an error for
> that and i
> did some research
> (http://joannaandjohn.blogspot.com/2010/02/testing-request-and-session-scoped.html
> )
> and it looks like im using the regular applicationContext instead of
> webapplicationcontext?
>
> Any ideas on this?
>
> Thanks
> --
> View this message in context: http://jersey.576304.n2.nabble.com/SpringServlet-support-when-Spring-is-not-started-from-a-web-context-tp5050797p5794189.html
> Sent from the Jersey mailing list archive at Nabble.com.