You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Mylonas <ch...@opencsta.org> on 2015/04/12 06:29:41 UTC

IoC Service, call a method after instantiation/realization

Hi Tapestry Users,

Tapestry development is on the horizon again for me and I'm just making  
some tweaks to an app that I'm trying to load in another CMS's iframe!


After service class instantiation, I'd like to call a method so it does  
something (e.g. create an admin user if none exist)

     //annotate with tapestry service initlised post runner
     @PostInjection or @Startup
     private void createAdminUser(){
         SubnetsUser u = new SubnetsUser();
         u.setRole(Role.ADMIN);
         u.setEmail("chris@opencsta.org");
         u.setPassword("subnets");
         save(u);
     }

Is this the way?  Doesn't seem to be working at the moment for me

Thanks
Chris

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


Re: IoC Service, call a method after instantiation/realization

Posted by Chris Mylonas <ch...@opencsta.org>.
Thanks guys, I'll play around with @Startup in the next day or so.

Unfortunately my workflow at the moment is tapestry/hibernate at prototype  
stage then moves to EJB with JPA when things get serious!


On Sun, 12 Apr 2015 20:36:51 +1000, Kalle Korhonen  
<ka...@gmail.com> wrote:

> Also, if you are using Hibernate or JPA, you should definitely check out
> http://tynamo.org/tapestry-hibernate-seedentity+guide for the entity
> seeding needs.
>
> Kalle
>
> On Sun, Apr 12, 2015 at 3:26 AM, Charlouze <me...@charlouze.com> wrote:
>
>> Hey!
>>
>> The tapestry @startup annotation is to be used in modules. The annotated
>> method will be called upon application startup after the registry  
>> setup. If
>> you need those methods to be called in a specific order, you should
>> contribute to RegistryStartup.
>>
>> I hope it'll help you.
>>
>> Le dim 12 avr. 2015 06:30, Chris Mylonas <ch...@opencsta.org> a écrit :
>>
>> > Hi Tapestry Users,
>> >
>> > Tapestry development is on the horizon again for me and I'm just  
>> making
>> > some tweaks to an app that I'm trying to load in another CMS's iframe!
>> >
>> >
>> > After service class instantiation, I'd like to call a method so it  
>> does
>> > something (e.g. create an admin user if none exist)
>> >
>> >      //annotate with tapestry service initlised post runner
>> >      @PostInjection or @Startup
>> >      private void createAdminUser(){
>> >          SubnetsUser u = new SubnetsUser();
>> >          u.setRole(Role.ADMIN);
>> >          u.setEmail("chris@opencsta.org");
>> >          u.setPassword("subnets");
>> >          save(u);
>> >      }
>> >
>> > Is this the way?  Doesn't seem to be working at the moment for me
>> >
>> > Thanks
>> > Chris
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>>


-- 
Using Opera's mail client: http://www.opera.com/mail/

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


Re: IoC Service, call a method after instantiation/realization

Posted by Kalle Korhonen <ka...@gmail.com>.
Also, if you are using Hibernate or JPA, you should definitely check out
http://tynamo.org/tapestry-hibernate-seedentity+guide for the entity
seeding needs.

Kalle

On Sun, Apr 12, 2015 at 3:26 AM, Charlouze <me...@charlouze.com> wrote:

> Hey!
>
> The tapestry @startup annotation is to be used in modules. The annotated
> method will be called upon application startup after the registry setup. If
> you need those methods to be called in a specific order, you should
> contribute to RegistryStartup.
>
> I hope it'll help you.
>
> Le dim 12 avr. 2015 06:30, Chris Mylonas <ch...@opencsta.org> a écrit :
>
> > Hi Tapestry Users,
> >
> > Tapestry development is on the horizon again for me and I'm just making
> > some tweaks to an app that I'm trying to load in another CMS's iframe!
> >
> >
> > After service class instantiation, I'd like to call a method so it does
> > something (e.g. create an admin user if none exist)
> >
> >      //annotate with tapestry service initlised post runner
> >      @PostInjection or @Startup
> >      private void createAdminUser(){
> >          SubnetsUser u = new SubnetsUser();
> >          u.setRole(Role.ADMIN);
> >          u.setEmail("chris@opencsta.org");
> >          u.setPassword("subnets");
> >          save(u);
> >      }
> >
> > Is this the way?  Doesn't seem to be working at the moment for me
> >
> > Thanks
> > Chris
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

Re: IoC Service, call a method after instantiation/realization

Posted by Charlouze <me...@charlouze.com>.
Hey!

The tapestry @startup annotation is to be used in modules. The annotated
method will be called upon application startup after the registry setup. If
you need those methods to be called in a specific order, you should
contribute to RegistryStartup.

I hope it'll help you.

Le dim 12 avr. 2015 06:30, Chris Mylonas <ch...@opencsta.org> a écrit :

> Hi Tapestry Users,
>
> Tapestry development is on the horizon again for me and I'm just making
> some tweaks to an app that I'm trying to load in another CMS's iframe!
>
>
> After service class instantiation, I'd like to call a method so it does
> something (e.g. create an admin user if none exist)
>
>      //annotate with tapestry service initlised post runner
>      @PostInjection or @Startup
>      private void createAdminUser(){
>          SubnetsUser u = new SubnetsUser();
>          u.setRole(Role.ADMIN);
>          u.setEmail("chris@opencsta.org");
>          u.setPassword("subnets");
>          save(u);
>      }
>
> Is this the way?  Doesn't seem to be working at the moment for me
>
> Thanks
> Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>