As far as I know there is no other direct solution. An indirekt one is to have a separate service layer for the bean. In the dao/daoImpl example:
<bean id="daoService" class="DaoServiceImpl (impl of DaoService interface)"> <property name="dao" ref="daoImpl"/> </bean> and then you can @Inject DaoService daoService; But using the ApplicationContext service isn't that bad. Regardless of the true lore of decoupling... it is VERY unlikely that you change the DI container or the bean id's in any non-trivial application. 2009/5/24 moonlee <moonleel...@hotmail.com> > > Hi, Otho. > Do you have some solutions for then problem. > I get the exceptions now, and I don't want to use the ApplicationContext > Service > to get bean by name. > > > Otho wrote: > > > > Since Spring beans are not exposed anymore as services I get exceptions > > like > > > > > > Error obtaining injected value for field org.example.user.Login.dao: > > Spring > > context contains 2 beans assignable to type org.example.dao.Dao: dao, > > daoImpl. > > > > I couldn't find anything in the docs about injecting by name. And the > > proposes workaround for non singletons with injecting ApplicationContext > > and > > then get the bean by name/id works, but is a bit awkward in cases like > > this. > > > > Is there some other possibility? If not, is support for injection by name > > planned in the future without the 5.0 compatibility mode? > > > > > > -- > View this message in context: > http://www.nabble.com/T-5.1-How-to-inject-Spring-beans-by-name--tp22934788p23690308.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 > >