Java EE - 谁实现了规范? [英] Java EE - who implement the specification?

查看:144
本文介绍了Java EE - 谁实现了规范?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在核心Java和Java EE方面有一些经验。我阅读了关于SO的各种问题以了解Java EE究竟是什么? SO中的答案很少: what-exactly-is-java-ee ,< a href =https://stackoverflow.com/questions/106820/what-is-java-ee> what-is-java-ee



我有一些疑问:1)如果Java EE只是一个规范,谁来实现它们?应用服务器(如JBOSS,GlassFish)是否实现了这些规范?2)如果我正确的EJB规范是由EJB容器实现的,我相信EJB容器是部分的的应用服务器。现在,当我们作为开发人员编写EJB代码时,我们究竟在做什么?我的疑问是,EJB容器实现了EJB规范,那么我们是否覆盖EJB的某些规范部分呢?怎么来,EJB的某些部分是由EJB容器实现的,还有一些开发人员正在编写的东西?或者是EJB的某些部分必须由EJB容器提供,还有一部分是由开发人员开发的?

任何人都可以帮助理解这一点吗?

解决方案

任何人都可以实现java ee规范( JSR342 ),或者是其中的任何 jsr 。当他们这样做时,他们可以(在购买并传递兼容性测试套件)声称与规范兼容。有许多供应商的应用程序服务器与兼容用java ee ,但没有供应商实现完整的java ee规范。例如,glassfish(java ee参考实现)使​​用Red Hat的 CDI 实现。有时候,供应商没有实现java ee规范的任何部分,他们抓住玻璃鱼,添加他们的供应商特定的库,并以他们的名字发布它。要声明兼容性,他们仍然需要通过认证过程并运行CTS。

为了找出所有实施该规范的供应商并不那么容易,因为并不是所有的供应商都通过认证过程。例如, Apache CXF 没有经过认证,而是被认证为Red Hat的JBoss。

每个规范都有一个API和一个书面PDF,它们都定义了每个实现的强制行为。这是编写EJB代码时使用的。例如,当你创建一个ejb时:

  import javax.ejb.Singleton; 
@Singleton
public class MySingleton {
...
}

@Singleton注释是规范的一部分,但是 MySingleton class是您的EJB代码,它不是规范的一部分。 EJB容器知道该如何处理该类。


I have some experience in core Java and Java EE. I read the various question on SO to understand what exactly Java EE is? And few answers in SO are: what-exactly-is-java-ee , what-is-java-ee

I have some doubts:

1) If Java EE is just a specification, who does implement them? Do Application Servers (like JBOSS, GlassFish) implement these specifications?

2) If I am correct the EJB specification is implemented by EJB container, and I believe EJB Container is part of Application Server. Now, when we as developers write an EJB code, what are we actually doing? The doubt I have is, EJB container implements the EJB specification, so are we overriding some "specification part" of the EJB? How come, some part of EJB is implemented by the EJB container and some thing which developers are writing? OR is it that some part of the EJB have to be provided by EJB container and some part to be developed by developers? I am having difficulty in undestanding this.

Please can anyone help in understanding this?

解决方案

Anybody can implement the java ee specification (JSR342), or any jsr that's part of it. When they do, they can (after buying and passing Compatibility Test Suite) claim to be compatible with the specification. There is a number of vendors with their application servers which are compatible with java ee, but no vendor implement full java ee specification. For instance, glassfish (the java ee reference implementation) uses Red Hat's CDI implementation. Sometimes, the vendor does not implement any part of the java ee specification, they grab glassfish, add their vendor specific libraries, and release it under their name. To claim compatibility, they still need to go through the certification process and run CTS.

To find out all the vendors who implement the specification is not so easy, since not all of them go through the certification process. For instance, Apache CXF is not certified on its own, rather it gets certified as part of Red Hat's JBoss.

Each specification has an API and a written pdf, both of which define the mandatory behaviour of each implementation. That is what you use when write EJB code. For instance, when you create an ejb:

import javax.ejb.Singleton;
@Singleton
public class MySingleton{
   ... 
}

@Singleton annotation is part of the specification, but MySingleton class is your EJB code, it's not part of the specification. The EJB container then knows what to do with the class.

这篇关于Java EE - 谁实现了规范?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆