What exactly is Java EE?
I have been doing Java SE for some years now and moving on to Java EE. However I have some trouble understanding some aspects of Java EE.
Is Java EE just a specification? What I mean is: Is EJB Java EE?
Are EJB/Spring different implementations of Java EE?
I am sorry to ask but I have some difficulties to understand what Java EE is. Could someone explain what Java EE is? And EJB?
Is Java EE just a specification? What I mean is: Is EJB Java EE?
Java EE is indeed an abstract specification. Anybody is open to develop and provide a working implementation of the specification. The concrete implementations are the so-called application servers, like WildFly, TomEE, GlassFish, Liberty, WebLogic, etc. There are also servlet containers which implement only the JSP/Servlet part of the huge Java EE API, such as Tomcat, Jetty, etc.
We, Java EE developers, should write code utilizing the specification (ie import only javax.*
classes in our code instead of implementation specific classes such as org.jboss.wildfly.*
, com.sun.glassfish.*
, etc) and then we'll be able to run our code on any implementation (thus, on any application server). If you're familiar with JDBC, it's basically the same concept as how JDBC drivers work. See also ao In simplest terms, what is a factory?
The Java EE SDK download from Oracle.com contains basically the GlassFish server along a bunch of documentation and examples and optionally also the NetBeans IDE. You don't need it if you want a different server and/or IDE.
EJB is part of the Java EE specification. Look, it's in the Java EE API. Full-fledged Java EE application servers support it out the box, but simple JSP/Servlet containers don't.
See also:
Are EJB/Spring different implementations of Java EE?
No, as said, EJB is part of Java EE. Spring is a standalone framework which substitutes and improves many parts of Java EE. Spring doesn't necessarily require Java EE to run. A barebones servletcontainer like Tomcat is already sufficient. Simply put, Spring is a competitor of Java EE. Eg "Spring" (standalone) competes EJB/JTA, Spring MVC competes JSF/JAX-RS, Spring DI/IoC/AOP competes CDI, Spring Security competes JAAS/JASPIC, etc.
Back during the old J2EE/EJB2 times, the EJB2 API was terrible to implement and maintain. Spring was then a much better alternative to EJB2. But since EJB3 (Java EE 5), the EJB API was much improved based on lessons learnt from Spring. Since CDI (Java EE 6), there's not really a reason to look at again another framework like Spring to make the developers more easy as to developing among others the service layer.
Only when you're using a barebones servletcontainer such as Tomcat and can't move on to a Java EE server, then Spring is more attractive as it's easier to install Spring on Tomcat. It isn't possible to install eg an EJB container om Tomcat without modifying the server itself, you would basically be reinventing TomEE.
See also:
Java Enterprise Edition (Java EE) is an umbrella specification that references a number of other more detailed specifications, of which Enterprise JavaBeans (EJB) is one of the more important ones.
Read this - it explains the difference between Java EE and Spring
Thanks...
Source -- Java 2 Platform, Enterprise Edition (J2EE) defines the standard for developing component-based multitier enterprise applications. J2EE simplifies building enterprise applications that are portable, scalable, and that integrate easily with legacy applications and data .
Source -- Enterprise JavaBeans (EJB) technology is the server-side component architecture for Java Platform, Enterprise Edition (Java EE). EJB technology enables rapid and simplified development of distributed, transactional, secure and portable applications based on Java technology.
Is Java EE just a specification? What I mean is: Is EJB Java EE?
Java EE is a specification.
EJB is server side component architecture for Java EE
Are EJB/Spring different implementations of Java EE?
上一篇: 在Java中使用OpenCV 2.4.10在jpg图片上应用sobel过滤器
下一篇: Java EE究竟是什么?