Are there any events that occurred when the EJB application started?

We are thinking of creating a client / server application where the server side will be an EAR application with some Beans session displaying an API. We would like to know if there is something like ServletContextListener for web modules in EJB modules so that we can know when the application is running on the server side.

Thanks in advance.

+3
source share
3 answers

There is no other mechanism in JEE5. ServletContextListener is the best, portable solution.

In JEE6, you can use Singleton EJB. You can annotate Singleton EJB with @Startup, and the EJB will be created when the application starts. Thus, for a pure EJB application without a WAR component, this will be the mechanism for this.

+4

Hartung , .

EAR EJB Web. , .

<initialize-in-order>true</initialize-in-order> Java EE 6 application.xml META-INF EAR.

, , , @Startup Singleton .

+2

. . .

EAR, ServletContextListener.

0

Source: https://habr.com/ru/post/1787502/


All Articles