The EJB 3.1 specification has been added to singleton session beans, which can be used to initialize an application in a portable, vendor-independent manner.
Quote from Designing a Singleton Beans Session , the following example illustrates a single-line bean session with initialization of a run using the @Startup annotation:
@Singleton @Startup public class ConfigurationBean implements Configuration { @PostConstruct public void initialize() {
If you are using EJB 3.1, which is part of the Java EE 6 specification, this is the standard way to initialize the application. WebSphere 8 and 8.5 support this specification level.
If you are using an outdated version of WebSphere or a specification, and you do not like the update, you can use Startup Beans , the WebSphere extension used for this purpose in previous versions.
Also +1 for Udo's answer.
source share