tomee-users mailing list archives

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

My recommendation would be to use the Servlet Module from deltaspike. I use
it for booting and it's really comfortable. See

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: " +

On 20 January 2014 16:30, Martin Strohal <> 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

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