You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alexander Lamb <al...@rodanotech.ch> on 2007/11/08 10:05:08 UTC

T5.0.7-SNAPSHOT: AppModule constructor not called??

Hello,

I have an AppModule with several services defined.
I need to initialize a few things when the application starts. I  
thought I would put them in the constructor of AppModule.

Well, depending on what is in the constructor, sometimes it is called,  
sometimes not.

Something as simple as:

   public AppModule() {
	System.out.println("---- AppModule init...");
	}

Prints out the trace correctly.

But if I add:

   public AppModule() {
	System.out.println("---- AppModule init...");
	StudiesFoundationInitializer initializer = new  
StudiesFoundationInitializer();
	}

It does not get get called.

Is this the correct way of doing things? Why does it silently not call  
AppModule?

Thanks

Alex
--
Alexander Lamb
Founding Associate
RODANOTECH Sàrl

4 ch. de la Tour de Champel
1206 Geneva
Switzerland

Tel:  022 347 77 37
Fax: 022 347 77 38

http://www.rodanotech.ch




Re: T5.0.7-SNAPSHOT: AppModule constructor not called??

Posted by Howard Lewis Ship <hl...@gmail.com>.
Module classes are not instantiated until a non-static method of the
module must be invoked.  Could this be the source of your issue?
Because Tapestry IoC services are lazily instantiated, you may be able
to navigate a section of your application before it becomes necessary
to instantiate the module class.

On Nov 8, 2007 1:05 AM, Alexander Lamb <al...@rodanotech.ch> wrote:
> Hello,
>
> I have an AppModule with several services defined.
> I need to initialize a few things when the application starts. I
> thought I would put them in the constructor of AppModule.
>
> Well, depending on what is in the constructor, sometimes it is called,
> sometimes not.
>
> Something as simple as:
>
>    public AppModule() {
>         System.out.println("---- AppModule init...");
>         }
>
> Prints out the trace correctly.
>
> But if I add:
>
>    public AppModule() {
>         System.out.println("---- AppModule init...");
>         StudiesFoundationInitializer initializer = new
> StudiesFoundationInitializer();
>         }
>
> It does not get get called.
>
> Is this the correct way of doing things? Why does it silently not call
> AppModule?
>
> Thanks
>
> Alex
> --
> Alexander Lamb
> Founding Associate
> RODANOTECH Sàrl
>
> 4 ch. de la Tour de Champel
> 1206 Geneva
> Switzerland
>
> Tel:  022 347 77 37
> Fax: 022 347 77 38
>
> http://www.rodanotech.ch
>
>
>
>



-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

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