Use either 

@InjectService("serviceId") 
private MyService myService;
or 

@ServiceId("serviceId") 
@Inject
private MyService myService;

Sent from my iPhone

On May 10, 2012, at 10:10 PM, George Christman <gchrist...@cardaddy.com> wrote:

> Well It worked for a single service implementing the interface, as soon as I
> added a second service it blew up :(
> 
> I was given this exception 
> Caused by: java.lang.RuntimeException: Error building service proxy for
> service 'Scheduler' (at
> org.mydomain.eprs.services.Scheduler(HibernateSessionSource, Session,
> AutocompleteCache, AutocompleteCache) (at Scheduler.java:34) via
> org.mydomain.eprs.services.AppModule.bind(ServiceBinder) (at
> AppModule.java:29)): Service interface
> org.mydomain.eprs.services.AutocompleteCache is matched by 2 services:
> UserAutocompleteCache, VendorAutocompleteCache.  Automatic dependency
> resolution requires that exactly one service implement the interface.
> 
> this is my code
> 
> public class AppModule {
> 
>    public static void bind(ServiceBinder binder) {
>        binder.bind(UserInfo.class, UserInfoImpl.class);
>        binder.bind(Scheduler.class);
>    }
> 
>    public static AutocompleteCache<ApplicationUser>
> buildUserAutocompleteCache() {
>        return new AutocompleteCacheImpl<ApplicationUser>() {};
>    }
> 
>    public static AutocompleteCache<IfasvVendor>
> buildVendorAutocompleteCache() {
>        return new AutocompleteCacheImpl<IfasvVendor>() {};
>    }
> 
> public class Scheduler {
> 
>    public Scheduler(AutocompleteCache<ApplicationUser>
> userAutocompleteCache,
>            AutocompleteCache<IfasvVendor> vendorAutocompleteCache) {
> 
> 
> I looked at Taha's suggestion "Disambiguation with Marker Annotations" in 
> http://tapestry.apache.org/defining-tapestry-ioc-services.html
> 
> however that example seemed like one interface implementing different
> classes, where as I have one interface implementing one class, ie the
> generic. 
> 
> Any thoughts or suggestions?
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Using-generics-in-tapestry-service-tp5700399p5700861.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

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

Reply via email to