What do you mean by started immediately?
Right after the application is started and the injector has been built?
Or right after the constructor, before field and setter injection?
On 04/09/2014 03:46 PM, Jochen Wiedmann wrote:
Hi,
after studying the sources of the LifecycleModule, I get the
impression that Onami suffers from the same problem than similar Guice
extensions do: They all work by registering a TypeListener (the
LifecycleModule), which in turn registers an InjectionListener. The
injection listeners method "afterInjection" is responsible for
invocation of the annotated start method.
The problem with that approach is that "afterInjection" is, by
default, invoked when Guice is actually creating the object. And Guice
does so, when, or even if, the injectors user requests the object.
This may be perfectly valid according to the specifications, but it is
not what I'd assume to be LifeCycle handling. I'd like to see that
objects annotated with @PostConstruct (or whatever other annotation)
are started immediately.
What do others think?
Thanks,
Jochen
--
"That's what prayers are ... it's frightened people trying to make
friends with the bully!"
Terry Pratchett. The Last Hero