英文:
Which criterias to consider when replacing the Java EE modules removed from JDK?
问题
在JDK 11中,Oracle已经从JDK中移除了以下模块:
java.xml.ws
java.xml.bind
java.xml.ws.annotation
以下是被移除模块可能的替代方案:
jakarta
com.sun.xml // 参考实现
在下面的链接http://openjdk.java.net/jeps/320中,建议使用sun的参考实现来替代这些模块。
选择适当的替代方案的标准是什么?
英文:
In JDK 11, Oracle has removed the following modules from the JDK:
java.xml.ws
java.xml.bind
java.xml.ws.annotation
The following are possible replacement for the removed modules:
jakarta
com.sun.xml // The reference Implementation
In the following link http://openjdk.java.net/jeps/320, it is recommended to replace the modules with the reference implementation from sun.
What are the criterias to choose the appropriate replacement?
答案1
得分: 2
这不是真正的“在Jakarta和Sun参考实现之间进行选择”。 Jakarta 现在是以前称为Java EE的东西(Oracle将其移交给了Eclipse Foundation并更名为Jakarta)。 这些标准是在Jakarta项目下开发的,对于每个标准(例如JAX-WS),都有一个参考实现。
其他供应商可能会独立实现这些标准。选择不是在“Jakarta或Sun的参考实现之间”,而是在参考实现和其他供应商的实现之间。
例如,看看JAXB(Java XML绑定API)。有一个参考实现,还有一个名为MOXy的独立实现,具有一些额外的非标准功能。
这是有关JAX-WS的Jakarta页面,列出了两个实现:具有Maven坐标jakarta.xml.ws:jakarta.xml.ws-api:jar:2.3.3
的参考实现,以及另一种替代实现Eclipse Metro。
要进行选择,您需要查看两者的功能,并决定要使用哪一个。
请注意,如果您正在运行Java EE或Jakarta EE应用服务器上的软件,可能已经包含了JAX-WS的实现。
编写您的程序针对JAX-WS API,而不是针对特定实现,除非您需要使用特定实现的非标准扩展(但这当然会使以后切换到不同实现变得困难)。
英文:
It's not really "choose between Jakarta or the Sun reference implementation". Jakarta is now what used to be called Java EE (Oracle handed it over to the Eclipse Foundation and it got a new name). The standards are developed under the Jakarta project, and for each standard (such as JAX-WS) there is a reference implementation.
Other vendors might implement the standard independently. The choice is not between "Jakarta or the Sun reference implementation", but between the reference implementation and an implementation by another vendor.
For example, look at JAXB (the Java API for XML Binding). There is a reference implementation and there is also MOXy, which is a separate implementation that has some extra, non-standard features.
Here is the Jakarta page about JAX-WS, which lists two implementations: the reference implementation which has Maven coordinates jakarta.xml.ws:jakarta.xml.ws-api:jar:2.3.3
, and Eclipse Metro which is an alternative implementation.
To choose, you need to look at the features of both and decide what you want to use.
Note that if you are running your software on a Java EE or Jakarta EE application server, there might already be an implementation of JAX-WS included with it.
Write your program against the JAX-WS API, and not against a particular implementation, unless you need to use non-standard extensions of a particular implementation (but that will, of course, make it hard to switch to a different implementation later).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论