Unfortunately, we're not aware of any correct solution for this problem. Bean archives from a web module should not have the default non-web BeanDeploymentModule assigned (current behavior). Instead, a default web module should exist. The problem is that we don't have enough information to distinguish such bean archives. Therefore we will log a warning that the event was fired twice. From user POV:
- @Initialized(ApplicationScoped.class) ServletContext will be delivered only once
- @Initialized(ApplicationScoped.class) Object will be delivered twice but a similar workaround could be used:
@ApplicationScoped |
class Initializer { |
|
// Initialize eagerly - will be notified twice |
void init(@Observes @Initialized(ApplicationScoped.class) Object event) { |
} |
|
@PostConstruct |
public void onStartup() { |
// Init logic will be invoked once... |
} |
}
|
|