[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: t5 Inject service to HttpSessionListener
From:       anujith amaratunga <anujith.amaratunga () oneworldglobal ! net>
Date:       2008-02-29 4:18:42
Message-ID: 15751750.post () talk ! nabble ! com
[Download RAW message or body]


Thanks Mark. I've tried this approach, but as you say it builds you a new
Registry. The problem is if you need a stateful service, i.e. a service
which handles persistence. Depending on your configuration this might give
you undesired results.

The solution suggested by Ted, 
http://www.nabble.com/t5-Inject-service-to-HttpSessionListener-to15736395.html#a15739548
 here , works, but as he points out, its not the cleanest solution.

cheers,

Anu


Mark W. Shead-2 wrote:
> 
> 
> You can create a registry by doing something like:
> RegistryBuilder builder = new RegistryBuilder();
> builder.add(MiniAppModule.class);
> Registry registry = builder.build();
> registry.performRegistryStartup();
> Hello hello = registry.getService(Hello.class);
> (See http://wiki.apache.org/tapestry/Tapestry5HowToIocOnly)
> 
> However this will create a new instance of the registry.  It won't be  
> the same instance that you have available elsewhere.  I don't know if  
> there is a way to get a reference to the same registry that is being  
> used by ioc elsewhere in the program.
> 
> Most of the time it doesn't really matter because your services should  
> usually be stateless anyway.
> 
> Mark
> 
> 
> 

-- 
View this message in context: \
http://www.nabble.com/t5-Inject-service-to-HttpSessionListener-tp15736395p15751750.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic