When developing a Java EE application, it is possible to use EJBs as controllers?
The EJB container provides features such as lifecycle management, and concurrency control, Is it correct create a stateless EJB to be a controller and injects it into a ManagedBean?
From EJB 3.0 and specially in 3.1, the EJB Beans become more and more POJOs thus the EJB concept blurs in favor of the more generic Managed Bean concept, inside the CDI. Even the @EJB
annotation "competes" with @Inject
and could eventually be replaced by it.
So in CDI, a controller can be a managed bean and take advantage of the Java EE server features like lifecycle management and such.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With