tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Kildén <karl.kil...@gmail.com>
Subject Re: Create CDI bean on application startup
Date Tue, 21 Jan 2014 10:24:10 GMT
Hello,

My recommendation would be to use the Servlet Module from deltaspike. I use
it for booting and it's really comfortable. See
http://deltaspike.apache.org/servlet.html

It's been mentioned as a todo in Omnifaces as well as in Deltaspike but the
relevant discussion in deltaspike lead me to believe that it was a
problematic approach. So yeah Servlet Module +1.




public void onCreate(@Observes @Initialized ServletContext context) {
    System.out.println("Initialized ServletContext: " +
context.getServletContextName());}



On 20 January 2014 16:30, Martin Strohal <martin.strohal@1und1.de> wrote:

> 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message