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 <[email protected]> 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
>