True, Romain. @ApplicationScoped starts lazily, and that's not a problem
for me, but when i have @Schedule code running every 1, 2, or 3 minutes,
and app definitely starts and @ApplicationScoped bean is referenced by
those @Schedule methods on @Singleton(Lock.WRITE) beans, which check email
server to download email and imports data into database, if new emails in
inbox.

works for me, and in response to OP, there is no need to migrate to @EJB
since @ApplicationScoped @PostConstruct can meet the requirement.



On Mon, Jan 20, 2014 at 11:01 AM, Romain Manni-Bucau
<[email protected]>wrote:

> @Howard: will not be executed on app startup :p
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2014/1/20 Howard W. Smith, Jr. <[email protected]>:
> > also, you can do @ApplicationScoped @PostConstruct; this is what I do in
> my
> > app. :)
> >
> >
> >
> > On Mon, Jan 20, 2014 at 10:32 AM, Romain Manni-Bucau
> > <[email protected]>wrote:
> >
> >> the easier will be to rely on ejb @Singleton @Startup.
> >> Romain Manni-Bucau
> >> Twitter: @rmannibucau
> >> Blog: http://rmannibucau.wordpress.com/
> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> Github: https://github.com/rmannibucau
> >>
> >>
> >>
> >> 2014/1/20 Martin Strohal <[email protected]>:
> >> > Hi,
> >> >
> >> > I'm using TomEE 1.5.2 and I want some application code to be executed
> on
> >> application (WAR) startup. It's a loader which reads a configuration
> file.
> >> The class is a CDI class, but  no other class has a reference to it.
> That's
> >> why it is not created normally.
> >> > What's the best way to do that? Must I convert the class to an EJB? Or
> >> is there a CDI mechanism?
> >> >
> >> > Thanks!
> >> >
> >> > Martin
> >>
>

Reply via email to