What was actually the reason for not exposing Spring beans as Tapestry
services as of 5.1? I don't recall it anymore.

On Tue, Feb 1, 2011 at 11:20 PM, Alex Kotchnev <akoch...@gmail.com> wrote:

> The question of how to inject a Spring bean by ID is a regular on the
> mailing list . The documentation provides a reasonable explanation of how
> to
> inject spring beans or the context (
> http://tapestry.apache.org/integrating-with-spring-framework.html), e.g:
>
> @Inject
> private UserDAO userDAO;
>
> This should find an implementation of the UserDAO and inject it into the
> page/component. If there are multiple implementations of the same service,
> there would be an error , and then the page author will have to do
> something
> like:
>
> @Inject
> private ApplicationContext springContext;
>
> public void someMethod() {
>     UserDAO userDao = (UserDAO) springContext.getBean("userDaoId")
>
> }
>
> Thus, the question that pops into my head is : if there is just this one
> extra line, how come Tapestry doesn't do it for me ? Maybe it wouldn't use
> the same generic @Inject annotation, maybe it could use some extra
> annotation or something to specify the ID (in the spring context) of the
> spring bean to be injected, e.g. :
>
> @Inject @SpringId("myUserDao")
> private ApplicationContext springContext;
>
>
> Cheers,
>
> Alex K
>



-- 
Best regards,

Igor Drobiazko
http://tapestry5.de

Reply via email to