On May 6, 2009, at 2:21 AM, Scott Hernandez wrote: > The inject manager isn't adding this class to the registered beans. I > have seen a few issues with Generic classes with matching classes but > this ones seems pretty straight forward. > > Does anything anyone know why this isn't picked up and registered in > the inject manager?
I'm not sure that @New is supposed to be allowed on the class itself, but that part of the spec has been changing a bit. But the main issue is that generic classes are not "simple beans", because the generic type is part of the Java Injection matching algorithm. In other words, you can register a Foo<String> (using a producer method), but not a Foo<X>, because that's not a complete type. In other words, if you want to register a parameterized class, you currently need to have a @Produces factory for the class. -- Scott > > > @New > public class InjectBeanHelper<T> { > > @Current Manager mgr; > > public InjectBeanHelper(){} > > @SuppressWarnings("unchecked") > public T getInstance(String clazz){ > T o = null; > Class<? extends T> tc = null; > try { > tc = (Class<? extends T>) Class.forName(clazz); > o = (T)mgr.getInstanceByType(tc); > }catch(ClassNotFoundException e){} > > if(o==null) o = (T)mgr.getInstanceByName(clazz); > > return o; > } > public T getInstance(Class<? extends T> clazz){ > return this.mgr.getInstanceByType(clazz); > } > } > > I'm still working against trunk :) > > > _______________________________________________ > resin-interest mailing list > resin-interest@caucho.com > http://maillist.caucho.com/mailman/listinfo/resin-interest _______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest