*- Do you know you can use injection (no annotations needed) in build,
contribute and advise methods in Tapestry-IoC module classes? ;) *
You mean in the method signature ? It's of course different from injecting
services in the module but how is it different tapestry-wise ?

*- What about its constructor? This will work only if this initialization
doesn't use other services. *
Well that's not always the case but only today I remembered the
@PostInjection annotation. I gave it a try along with eagerLoad() and it
worked perfectly. Only that javax.inject.Inject doesn't work with
org.slf4j.Logger. Only tapestry's @Inject and @InjectResource !

*- Another option is to contribute to the RegistryStartup configuration a
Runnable that invokes your service. Just calling it directly in
contributeRegistryStartup() makes the call to happen before the registry
was actually started up. *
Well that is what I'm actually doing. Only that I'm injecting services in
the module, while it looks like injecting the service through the
contribute method signature is a better practice. Also you are saying that
the runnable will run *before* the registry starts up, isn't that a problem
if I'm calling injected services ? I know it isn't as I'm already doing it.


On Thu, Jun 14, 2012 at 9:01 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Thu, 14 Jun 2012 15:41:59 -0300, Muhammad Gelbana <m.gelb...@gmail.com>
> wrote:
>
>  I'm injecting the service in the module class just to be able to call it
>> in the registry-contribution method to test the service once the
>> applications starts up.
>>
>
> Do you know you can use injection (no annotations needed) in build,
> contribute and advise methods in Tapestry-IoC module classes? ;)
>
>
>  But actually in production i'm doing the same, to call some of
>> my services methods to initialize them in a way, but since it looks weird
>> how do you guys think I should initialize a service ?
>>
>
> What about its constructor? This will work only if this initialization
> doesn't use other services.
>
>
>  is the eagerLoad() method while binding the only way ?
>>
>
> Another option is to contribute to the RegistryStartup configuration a
> Runnable that invokes your service. Just calling it directly in
> contributeRegistryStartup() makes the call to happen before the registry
> was actually started up.
>
>
>  Makes me think, when I was first learning about tapestry I had many
>> things done in the wrong way or even not-so-right way and the application
>> continued to grow based on these wrong concepts.
>>
>
> I call that learning. :)
>
>
> --
> Thiago H. de Paula Figueiredo
>



-- 
*Regards,*
*Muhammad Gelbana
Java Developer*

Reply via email to