You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "squallmat ." <sq...@gmail.com> on 2014/07/17 17:31:45 UTC

tapestry injecting spring services

I used at many times injections of spring services bean in my tapestry
pages and that works really well.
But now I need to use them in Encoders class, when I do that :

public class ApplicatifDtoEncoder implements ValueEncoder<ApplicatifDto> {

@Inject
IServiceApplicatif serviceApplicatif;
.......


My serviceApplicatif stays null. Is it possible to make @Inject works here
? outside of tapestry pages ?

Re: tapestry injecting spring services

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 17 Jul 2014 12:31:45 -0300, squallmat . <sq...@gmail.com>  
wrote:

> public class ApplicatifDtoEncoder implements ValueEncoder<ApplicatifDto>  
> {
>
> @Inject
> IServiceApplicatif serviceApplicatif;
> .......
>
> My serviceApplicatif stays null. Is it possible to make @Inject works  
> here ? outside of tapestry pages ?

Injection only happens in Tapestry-controlled classes (pages, components  
and mixins) or Tapestry-IoC instantiated objects (services or objects  
created with ObjectLocator.autobuild()). In other words, no injection  
happens if you get your object by instantiating it yourself (using the  
'new' keyword).

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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