Re: Tapetsry IoC starting a class with background task that uses an injected service

2013-11-22 Thread Muhammad Gelbana
ocessIncomingMail(from, to, messageText); > > } catch (DAOException ex) { > > ex.printStackTrace(); > > } > > return false; > > } > > > > class MailReceiverThread extends TimerTask { > > > > public void r

Re: Tapetsry IoC starting a class with background task that uses an injected service

2013-11-22 Thread Dmitry Gusev
S); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > } > > - Original Message - > From: Thiago H de Paula Figueiredo > To: Tapestry users > Sent: Friday, November 22, 2013 5:26 PM

Re: Tapetsry IoC starting a class with background task that uses an injected service

2013-11-22 Thread Thiago H de Paula Figueiredo
On Fri, 22 Nov 2013 15:47:10 -0200, John wrote: I need my setup method to run when this class is instantiated but log is null so mailDAO will also be null. Weird. Maybe the @EagerLoad-annotated method is being called before the field injection is done. If that's really the case, that's a b

Re: Tapetsry IoC starting a class with background task that uses an injected service

2013-11-22 Thread John
x) { ex.printStackTrace(); } } } } - Original Message - From: Thiago H de Paula Figueiredo To: Tapestry users Sent: Friday, November 22, 2013 5:26 PM Subject: Re: Tapetsry IoC starting a class with background task that uses an injected service O

Re: Tapetsry IoC starting a class with background task that uses an injected service

2013-11-22 Thread Thiago H de Paula Figueiredo
On Fri, 22 Nov 2013 14:03:10 -0200, John wrote: How do I get this class to load when I start my app and make sure the injected services are set? With EagerLoad the class gets instantiated but of course the services are null. This statement is not correct as far as I know. Tapestry-IoC inje

Re: Tapetsry IoC starting a class with background task that uses an injected service

2013-11-22 Thread Muhammad Gelbana
I don't believe eager loading loads a service without it's dependencies injected. Try starting your background service in a @Startup annotation method in your module's class. Starting your service just means calling one of it's methods. *-* *Muhammad Gelbana* http://www.linkedi

Re: Tapetsry IoC starting a class with background task that uses an injected service

2013-11-22 Thread Dmitry Gusev
Put it to ParallelExecutor? http://tapestry.apache.org/parallel-execution.html http://blog.tapestry5.de/index.php/2011/09/18/scheduling-jobs-with-tapestry/ There's also Quartz scheduler support: https://github.com/anjlab/anjlab-tapestry-commons/tree/master/anjlab-tapestry-quartz On Fri, Nov 22

Tapetsry IoC starting a class with background task that uses an injected service

2013-11-22 Thread John
I have a utility class that recieves emails with a background TimerTask that needs to invoke a method on one of my injected DAOs to store the messages in the db. How do I get this class to load when I start my app and make sure the injected services are set? With EagerLoad the class gets instan