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

List:       tapestry-user
Subject:    Re: t5: building injected objects
From:       Sergio Esteves <sergio.esteves () xpand-it ! com>
Date:       2010-12-29 16:07:59
Message-ID: 4D1B5CDF.7020508 () xpand-it ! com
[Download RAW message or body]

The service id is the word that appears after the "build"? Like, if I do 
this:

«OfflineJob buildFoo(@InjectService("EjbContext") Context ejbContext) throws \
NamingException { ... } OfflineJob buildBar(@InjectService("EjbContext") Context \
ejbContext) throws NamingException { ... }»

Will I be able to do

«@Inject
private OfflineJob foo;

@Inject
private OfflineJob bar;»

?

Thanks.



On 29-12-2010 15:42, Robert Zeigler wrote:
> Both could be built, but you'll get an exception at runtime because Tapestry can't \
> disambiguate which service you want injected. You would need to either specify the \
> service id of (foo or bar) of the service you want injected, or else mark the two \
> services in some way and use said marker annotation to uniquely identify the \
> service that you want injected. See also: \
> http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/ioc/annotations/Marker.html
>  
> Robert
> 
> On Dec 29, 2010, at 12/299:33 AM , Sergio Esteves wrote:
> 
> > Hi all,
> > 
> > If I have a class with this:
> > «@Inject
> > @OfflineJob engine;»
> > 
> > and my project class:
> > 
> > «OfflineJob buildFoo(@InjectService("EjbContext") Context ejbContext) throws \
> > NamingException { ... } OfflineJob buildBar(@InjectService("EjbContext") Context \
> > ejbContext) throws NamingException { ... }» 
> > Which method will it use to build the engine object?
> > 
> > Thanks.
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
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