straight left 2021-02-23 16:03:39
j2ee ee

I use java Of spring It's been a while . In the process of learning and applying , Access to some information , More or less J2EE, The two are often compared . It's not used Java before , I've also heard of this J2EE. For what is J2EE, I've always been confused , I don't know .

One 、 What is? J2EE

J2EE(Java 2 Platform Enterprise Edition,Java 2 Platform enterprise )

j2EE Namely java Enterprise Edition .

Sounds , It's like a tacky business software , What's the experience version , The standard version , Deluxe edition , Flagship or something .

Java Three versions of : Java SE( The standard version ),Java EE( Enterprise Edition ),Java ME( Miniature version ).

J2EE Inside 2 What does that mean?

1998 year Java 1.2 Version release ,1999 Released in Java 1.2 Standard Edition , Enterprise Edition , Mini version, three versions , To distinguish the three versions , named Java2SE,Java2EE,Java2ME, abbreviation J2SE,J2EE,J2ME. therefore 2 Means 1.2 edition .java1.2 yes java It's a very important stop in China . After that 1.3,1.4 And 1.2 comparison , There are some changes , But not particularly big . So in 1.5 It was used before it was launched j2ee This is called , It's not called j3ee,j4ee.2005 year .java Introduction 1.5 edition , This is again. java A milestone in the history of development , And previous java The version has changed a lot , therefore sun Decided not to use this anymore j2ee Such a title , Of course, it's not used j5ee.J2EE Renamed Java EE,J2SE Renamed Java SE,J2ME Renamed Java ME. therefore , current J2EE The equivalent is 05 Years ago, the older generation called it .

So that's it . I thought , This 2 yes to It means .J2EE, Namely java to Yi . Yi Yi is a personal name . To make IT It's all over the place , Like writing a Book , In the preface, I must thank the whole family . that J2EE, It's a tribute to Yiyi Java frame ?

however ,J2EE There's nothing wrong with software , But to be exact , It's just a set of standards , It's a group built on JavaSE The standard above , Solve a series of problems in enterprise development . It has a set of interface conventions , Then, many manufacturers implement this standard , Such as JBoss,WebSphere etc. .

Two 、J2EE Architecture

J2EE By a whole set of services (services)、 Application program interface (APIs) And the Agreement constitutes , It is based on Web The multi tier application provides functional support . It defines dynamic Web Page functions (Servlet and Jsp)、 Commercial components (EJB)、 Asynchronous message transfer mechanism (JMS)、 Name and directory location services (JNDI)、 Database access (JDBC)、 Connector with subsystem (JCA) And security services .
 Insert picture description here
chart 1
 Insert picture description here
chart 2
 Insert picture description here
chart 3

A complete J2EE The server should include Web Container and EJB Containers .

J2EE Our architecture can be divided into four layers , As shown in the figure above .

1) The client layer : Responsible for direct interaction with users ,J2EE Supports a variety of clients , So the client can be WEB browser , It can also be dedicated Java client .

2) Server side component layer : This layer is based on WEB The application service of , utilize J2EE Medium JSP And Java Servlet technology , Can respond to client requests , And backward access to components that encapsulate business logic .

3)EJB layer : This layer mainly encapsulates business logic , Completely enterprise computers , Provides transaction processing , Load balancing 、 Security 、 Resource connection and other basic services , The program is writing EJB You don't have to care about these basic services , Focus on the implementation of business logic .

4) Enterprise information system layer : The enterprise information system layer includes the existing system of the enterprise ( Including database system 、 file system ),J2EE A variety of technologies are available to access these systems , Such as JDBC visit DBMS.

J2EE The main technical specifications in are JDBC、JNDI、EJB、JSP、Servlet、JTS、JTA、JMS..., wait .

Servlet: Defines how to deal with Web request , I believe you are most familiar with
Java Server Faces: Defines how to write Web Interface
JAX-RS: Defines how to write RESTFul The interface of
EJB: Defines how to write “ Enterprises Bean”
JPA: Defines how to write ORM And data access
JTA: Defines how to write transaction related code
JMS: Defines how to write a message queuing program
CDI: Defines how to write dependency injection
JAX: Defines how to write XML Program
JAX-WS: Defines how to write a program based on XML Network services for , namely SOAP……

3、 ... and 、EJB

EJB(Enterprise JavaBean), Also known as the enterprise Java Beans.

EJB Technology is in Java Bean Developed on the basis of 、 For the server side 、 Component technology for distributed applications .EJB yes J2EE Part of the norm , Has been widely developed , It has become the standard technology of application server .EJB Provides a framework for developing and implementing distributed business logic , Greatly simplified with scalability 、 Development of highly complex enterprise applications .

EJB To run on EJB Containers .EJB Containers are responsible for providing common services , Such as directory service 、 Business management 、 Security 、 Resource buffer pool and fault tolerance .EJB The specification defines EJB How do components relate to EJB The container interacts .

EJB It's not about achieving J2EE The only way , because J2EE Openness , So that some manufacturers can use one and EJB To achieve the same goal in a parallel way .

EJB Provides the basis for Java The reuse of binary bytecode .EJB The introduction of Technology , Make use of Java It is possible to develop server-side distributed applications based on component technology . From the perspective of enterprise application multi tier structure ,EJB It is the middleware technology of business logic layer . And JavaBeans The key difference is that it provides transactional capabilities .

 Insert picture description here
EJB There are three definitions of bean, They are conversation bean , Entity bean, And message driven bean.

Four 、EJB vs Java Bean

1、 What is? Java Bean

Java Bean Is in line with certain technical specifications Java class .

Java 1996 Released in , Same year 12 It was released in June Java Bean1.00-A. The value of an object can be set through a unified specification (get,set Method ), This is the original Java Bean. But in the actual enterprise development , Need to implement transactions 、 Security 、 Distributed ,javabean It's not easy to use . therefore sun The company started piling up functions , At this time Java Bean The complexity is EJB. However EJB Powerful is powerful , But it's too heavy , And then again DI( Dependency injection )、AOP( Face to face ) technology , Through simple Java Bean Also can be done EJB Things about , At this time Java Bean Simplified as POJO, therefore Spring The birth of .

One Java Does class count Java Bean, At least three conditions need to be met :

1) There is one public Default constructor ( For example, parameterless constructors ).

2) Attributes use public Of get,set Method access , That is to say, set it to private, meanwhile get,set The size of the method and the property name also need to correspond . Example attribute name,get The method is to write

public String getName(){

return "zhang3";

3) Support serialization .

2、EJB And Java Bean The difference between
here EJB Refer to EJB Components , It goes with Java Bean equally , All are Java Components written .

but Java Bean Is a local in-process component , Cannot be accessed across processes ;EJB Components are distributed components , be based on Java Remote method call to (RMI) technology , Can be accessed remotely ( Cross process 、 Across computers );

Java Bean It can be called directly in the program , but EJB Components cannot be directly accessed , To pass the EJB Containers ( Such as Webspere、WebLogic,JBoss) Indirect access to ,EJB The container is EJB The proxy for the component .

For simple server-side applications , Use JavaBean It's a good choice . If it's a complex server-side application , Use JavaBean Although the same effect can be achieved , But if you do that , All the underlying implementations have to be rewritten manually . and EJB Users don't have to care about its underlying operations , Because these are already provided by the container , And as long as you care about its external implementation .

3、EJB About equal to SSH/SSM
It's not about EJB And JavaBean Compare , It's better to EJB and SSH perhaps SSM Compare , Because they have the same goal .

SSH:Struts2 For the controller (controller) ,spring For the transaction layer (service), hibernate Responsible for the persistence layer (dao)

SSM:springMVC For the controller (controller) ,spring For the transaction layer (service), MyBatis Responsible for the persistence layer (dao)

A complete J2EE The server should include Web Container and EJB Containers .EJB To run on EJB Containers , and SSH perhaps SSM To run on Web Containers . In terms of volume ,EJB It's big ,SSH/SSM It's lightweight .

5、 ... and 、J2EE vs Spring

As mentioned above ,J2EE It's a set of standards , It has a set of interface conventions , Then, many manufacturers implement this standard .Spring Framework is an open source J2EE Application framework .( After a long time , original Spring It is J2EE One molecule )

In the early Spring It's about solving J2EE A series of problems in practical use , because J2EE Of API It's too hard to use .Spring The founder of the framework Rod I guess I went to a lot of big pits , So I summed up a set of best practices , And summed up in a framework . The most important , Is the so-called IoC( Inversion of control ).

Spring Use or implement extensively J2EE standard . such as spring-mvc Is in servlet Packaging on the basis of ;spring It doesn't provide the container itself , It's about using any support servlet Standard container ( Such as tomcat,jetty etc. );spring-data It has also been realized. JPA, Through the standard interface for CRUD etc. . In the final analysis Spring Just want to better solve practical problems .J2EE If you do a good job, use , Not well done , Independent implementation or encapsulation in a more appropriate way .

Over time ,J2EE It's falling behind , This is due to its system .J2EE The formulation of the plan is adopted by several giants at regular meetings , Release . Then the big container will follow up with the manufacturer . But it's too slow . The development speed of the Internet is far from being able to adapt to such a rigid system . take the reverse into consideration Spring Relatively fast .Spring I'm a company , I think the whole community is cutting-edge , The most urgent need immediately responded to do . such as ,Restful Just in fashion , You are willing to wait a year and a half for it to be published JAX-RS standard , And then there's Jersey, Ability to use ; Or choose to use it directly Spring MVC Just do it ? The result is self-evident . The attitude towards solving problems is the main reason why they are in different situations . Earliest stage J2EE It's the leader , If all technology companies want to be in this circle , We have to follow the standard . and Spring After gradually taking the lead ,J2EE On the contrary, some of the standards should follow Spring go .

 Insert picture description here
See Spring

Reference article :

About J2EE and Spring What kind of relationship is it now , And what's the future of both , Is there a competitive market ?

JAVA Development and J2EE What's the difference between development ?

The illustration EJB Architecture of

J2EE The foundation EJB

Java bean What is the concept ?

本文为[straight left]所创,转载请带上原文链接,感谢

  1. Spring can still play like this! Ali's new spring product has successfully overturned my understanding of spring!
  2. IntelliJ idea can also draw mind maps. It's really the strongest ide!
  3. JavaScript performance optimization [inline cache] V8 engine features
  4. linux 配置java环境
  5. linux find 查找文件
  6. 深入理解 Web 协议 (三):HTTP 2
  7. IntelliJ IDEA 相关问题记录
  8. Deep understanding of Web protocol (3): http 2
  9. 深入理解 Web 协议 (三):HTTP 2
  10. 腾讯IEG开源AI SDK:自动化测试吃鸡、MOBA类游戏
  11. Mysql Command
  12. Configuring Java environment with Linux
  13. Find files in Linux
  14. docker-Dockerfile 创建镜像
  15. Redis Cluster
  16. 深入理解 Web 协议 (三):HTTP 2
  17. JavaScriptBOM操作
  18. JavaScriptBOM操作
  19. Deep understanding of Web protocol (3): http 2
  20. Record of IntelliJ idea related problems
  21. Deep understanding of Web protocol (3): http 2
  22. Tencent IEG open source AI SDK: automatic testing of chicken eating and MoBa games
  23. Mysql Command
  24. Docker dockerfile create image
  25. Redis Cluster
  26. 死磕Spring之IoC篇 - 文章导读
  27. Deep understanding of Web protocol (3): http 2
  28. JavaScript BOM operation
  29. JavaScript BOM operation
  30. 死磕Spring之IoC篇 - 文章导读
  31. k8s node 操作与维护
  32. k8s 证书更新
  33. 【Java面试题第三期】JVM中哪些地方会出现内存溢出?出现的原因是什么?
  34. HashMap连环问你能答出几道?
  35. k8s-cronjob
  36. k8s-cert
  37. 头条面试官:说说Kafka的消费者提交方式,怎么实现的
  38. 什么是HTTPS以及如何实施HTTPS?
  39. Spring: an introduction to IOC
  40. Spring: an introduction to IOC
  41. Operation and maintenance of k8s node
  42. K8s certificate update
  43. vue使用sdk进行七牛上传
  44. k8s-dns
  45. JavaScript 邮箱验证 - 正则验证
  46. k8s-dashboard
  47. HashMap连环问你能答出几道?
  48. Where does memory overflow occur in the JVM? What are the reasons for this?
  49. How many questions can you answer?
  50. k8s-cronjob
  51. spring注解--Transactional
  52. k8s-cert
  53. Will the Spring Festival holiday be extended to February 27 in 2021? Here comes the response
  54. Headline Interviewer: talk about Kafka's consumer submission method, how to achieve it
  55. 【k8s集群】搭建步骤
  56. k8s-kubeadm
  57. k8s-etcd
  58. What is HTTPS and how to implement it?
  59. Java中使用HashMap改进查找性能
  60. maven发布jar包运行时找不到类问题