|
From: Paulo S. <pau...@gm...> - 2008-08-08 18:20:38
|
Sorry, I forgot to check the mailing list address in the CC...
---------- Forwarded message ----------
From: Paulo Siqueira <pau...@gm...>
Date: Fri, Aug 8, 2008 at 3:12 PM
Subject: Re: [Resteasy-developers] Problem with Spring and RestEasy
integration
To: Bill Burke <bb...@re...>
Hi Bill,
We don't want an instance per request. It doesn't matter at moment actually.
The problem is that it isn't working even with everything singleton (which
is the default scope in singleton). Do we have to do anything special to
flag the RESTful beans as singleton?
The main problem is the a dependency of the RESTful bean is not being
injected sometimes, although the bean itself is always there, thus giving us
NullPointers. In the example Fabio sent it would be the field "Seci" that
would end up being null.
[]s,
On Fri, Aug 8, 2008 at 12:16 PM, Bill Burke <bb...@re...> wrote:
> So you want a instance per request model?
>
> I'm not that familiar with spring and the RestEasy code expects a
> singleton model.
>
> I'll try out your code and see if I can figure things out.
>
> Fábio Serra wrote:
> > Hi,
> >
> > We have a problem integrating RestEasy and Spring. It seems like when
> > two users access the same resource at the same time, the
> > SpringContextLoaderListener is not injecting after the first instance.
> > After that all the resource instances aren't injected by Spring causing
> > NullPointerException at the spring injected objects.
> >
> > My web.xml is the same as the examples of this integration.
> >
> > Here is my resource class:
> > @Service("locating")
> > @Path("/")
> > public class LocatingResource {
> > public LocatingResource() {
> > System.out.println("Instanciando....");
> > }
> >
> > @GET
> > @Path("locating")
> > public String getLocating() {
> > System.out.println("Class: "+ this);
> > System.out.println("LOCATING...("+getSpringTest()+")");
> > return getSeci().toString();
> > }
> >
> > @Resource
> > private Seci seci;
> > public void setSeci( Seci seci ) {
> > System.out.println("Classe1: " +this);
> > System.out.println("SACI2: "+ seci);
> > this.seci = seci;
> > }
> > public Seci getSeci() {
> > return this.seci;
> > }
> > }
> >
> > My ApplicationContext.xml :
> > <beans xmlns="http://www.springframework.org/schema/beans"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:context="http://www.springframework.org/schema/context"
> > default-autowire="byName"
> > xsi:schemaLocation="http://www.springframework.org/schema/beans
> >
> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >
> http://www.springframework.org/schema/context
> >
> > http://www.springframework.org/schema/context/spring-context-2.5.xsd"
> >
> > >
> > <context:annotation-config/>
> > <context:spring-configured/>
> > <context:component-scan base-package="padauan"
> > annotation-config="true"/>
> > </bean>
> >
> >
> > Thanks,
> >
> > Fabio Serra
> >
> > ------------------------------------------------------------------------
> > Novos endereços, o Yahoo! que você conhece. Crie um email novo
> > <
> http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses
> >
> > com a sua cara @ymail.com ou @rocketmail.com.
> >
> >
> > ------------------------------------------------------------------------
> >
> > -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> > Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> > Grand prize is a trip for two to an Open Source event anywhere in the
> world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Resteasy-developers mailing list
> > Res...@li...
> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
--
Paulo R C Siqueira
SCJP / SCWCD
http://www.ipti.org.br
Contato: (11) 8149-5046
--
Paulo R C Siqueira
SCJP / SCWCD
http://www.ipti.org.br
Contato: (11) 8149-5046
|