What is JavaEE, what is Spring

Author: Large broad
link: https: //www.zhihu.com/question/268742981/answer/341770209
Source: know almost
copyrighted by the author. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.

Before answering the main question of questions, I have to briefly explain what is JavaEE, what is Spring.

JavaEE is built on a set of JavaSE standard , a series of problems to solve enterprise-level development. Please pay special attention to, it is just a standard is agreed on a series of interfaces, many manufacturers do around this standard to achieve. The JBoss, WebSphere like. The first version of JavaEE 1.2 was released in 1999, 2017 JavaEE 8, it has gone through nearly 20 years.

So what are JavaEE standard to solve the problem? I am here to look at a short list of the main criteria:

  • Servlet: define how to handle Web requests, I believe we are most familiar
  • Java Server Faces: defines how to write Web Interface
  • JAX-RS: defines the interface of how to write RESTFul
  • EJB: defines how to write "Enterprise Bean"
  • JPA: defines how to write data access and ORM
  • JTA: defines how to write code related matters
  • JMS: it defines how to write a program message queue
  • CDI: defines how to write dependency injection
  • JAX: defines how to write XML program
  • JAX-WS: defines how to write XML-based Web services, namely SOAP
  • ……

See these, you may find the opportunity, in fact, often you usually use some standard interfaces, even if you think you are using Spring.

Spring What is it? Spring can be traced back from 2002 to 2004. In those years of Rod Johnson he published two books: "Expert One-on-One J2EE Design and Development" and "Expert One-on-One J2EE Development without EJB", and the first few versions of Springframework.

Early Spring J2EE targeted at solving a series of problems in actual use, because the JavaEE API it is too hard to use. Rod is estimated that a lot of times the pit, then summed up a set of best practices, and concluded that a set framework. One of the most important, is the so-called IoC (Inversion of Control).

After years of development, Spring release a lot of components:

  • spring-core: Spring Bean of management, control, and application context inversion
  • spring-mvc: model-view-controller web development in
  • spring-data: data access layer and the package
  • spring-boot: spring family bucket self-configuration and deployment management tools
  • spring-batch: a simple batch framework
  • spring-cloud: supports integration with many cloud service interface
  • spring-security: authentication and rights management
  • ……

In fact, a lot of spring in use or implements JavaEE standard. Such as spring-mvc is encapsulated in a servlet basis. spring itself does not provide container, but rather support the use of any standard servlet container support (such as tomcat, jetty, etc.). spring-data also realized JPA, performs CRUD standard interface.

Ultimately Spring just want to better solve practical problems . JavaEE implementations do well to use, with a more appropriate way to do implemented independently or bad package. Commonly known as "ground gas."

Seen a lot of people like to use "JavaEE vs Spring" questions lead to war. However, it can be seen from the above description JavaEE and Spring are not opposites. As a development engineer, which can solve the problem but it is still, good ecology, support, and low cost to use which. And mixed up with no big problems.

Over time, JavaEE has been getting behind, because its institutions as a result. JavaEE formulated by several giant met through regular consultations, publishing. Then a big container manufacturers achieve follow-up. But this is too slow. The pace of development of the Internet has been far from such a rigid system can adapt. Spring on the other hand, is relatively quick and more. Spring is his own company, something that the whole community the most advanced and struggling to find a response immediately do it. For example, Restful just popular, you are willing to wait a year or so out of JAX-RS standard, then a Jersey, can be used; or select directly with Spring MVC directly put things to do? Results speak for themselves. To problem-solving attitude is different from both the current situation the main reason.

The earliest JavaEE leader, all technology vendors in order to mix this circle, must go along with the standard. After the Spring and gradually occupy the leading position, JavaEE some standards but to go along with Spring. CDI is a good example. Spring IoC is the core of the framework. It addresses only import classes in Java, but can not issue import components. This problem js, python environment like a piece of cake. But in Java, without IoC, programmers will spend a lot of time writing new and set, assemble the entire service references relationship (you do not think this is inhumane?). After the popular Spring, JavaEE was released in 2009, CDI standard. Its appearance is to look just like the Spring of Annotation changed the name of it.

If future development, I think JavaEE already without future. JavaEE doing well in those, or other frameworks can easily blending standards continue to exist; those who have been criticized as Xiang, such as JSF; or a start there is no market, such as CDI, will be the period of the Wiki blocks of text records. However, Spring is not necessarily better. In the Java system have to face him play, vert.x impact; outside the system, it would be tremendous pressure on other locales, such as nodejs, python and go. Spring said flexible JavaEE relative terms.

Whether standards, frameworks, services, is to solve the problem exists, but not as "how OO", "how standards", "What the concept is clear." Which tool to solve good, resolved quickly, to use which. The last 2 to 3 years, further strengthen this reality docker + micro development services. A large number of new technologies will form their own ecosystem with the business.

This is actually a good thing, is not it?

 
https://www.zhihu.com/question/268742981

Guess you like

Origin www.cnblogs.com/feng9exe/p/11266880.html