Spring Web Services 3.0.4.RELEASE和2.4.3.RELEASE發佈

Spring同時發佈了Web Services項目的兩個版本:作為開發主幹的3.0.4.RELEASE和作為運維的2.4.3.RELEASE。兩個版本都已更新,可以在Spring Framework 5.1.0上運行,支持Java 11。

Spring Web Services(Spring-WS)是Spring社區的一款產品,致力於創建文檔驅動的Web服務。它旨在促進契約優先的SOAP服務開發,允許使用操作XML有效負載的多種方法中的一種來創建靈活的Web服務。

在新版本的Spring Web Services中,最顯著的改進是支持Java 11。自從Java 9以來,一些關鍵的Java EE包(如核心XML包和基於soap的包)的可見性降低了,在Java 11中,這些包被完全刪除了。因此,要在Java 9及以上版本上使用Spring Web Services,開發人員不能再依賴於JDK提供關鍵的XML和基於soap的庫。

Spring Web Services構建文件中新增一個Java 11概要文件,其中包含開發人員必須添加到自己的構建文件中的額外依賴項。在使用Java 11時,開發人員應該將依賴項添加到構建文件中。下面是build.xml的一個片段,其中包含在版本3.0.4.RELEASE上Java 11所需要的依賴項:

<dependencies>
<dependency>
<groupid>com.sun.xml.ws/<groupid>
<artifactid>jaxws-ri/<artifactid>
<version>2.3.0/<version>
<type>pom/<type>
/<dependency>
<dependency>
<groupid>org.jvnet.staxex/<groupid>
<artifactid>stax-ex/<artifactid>
<version>1.7.8/<version>
/<dependency>
<dependency>
<groupid>com.sun.xml.messaging.saaj/<groupid>
<artifactid>saaj-impl/<artifactid>
<version>1.3.28/<version>
/<dependency>
<dependency>

<groupid>javax.xml.soap/<groupid>
<artifactid>javax.xml.soap-api/<artifactid>
<version>1.4.0/<version>
/<dependency>
<dependency>
<groupid>javax.xml.ws/<groupid>
<artifactid>jaxws-api/<artifactid>
<version>2.3.0/<version>
/<dependency>
/<dependencies>

仍然使用Spring Web Services 2.4.3.RELEASE的開發人員使用Java 11時不會有問題。這個版本只是使用了稍微舊一點的SOAP API(1.3.8)。下面是build.xml的一個片段,其中包含在版本2.4.3.RELEASE上Java 11所需要的依賴項:

<dependencies>
<dependency>
<groupid>com.sun.xml.ws/<groupid>
<artifactid>jaxws-ri/<artifactid>
<version>2.3.0/<version>
<type>pom/<type>
/<dependency>
<dependency>
<groupid>org.jvnet.staxex/<groupid>
<artifactid>stax-ex/<artifactid>
<version>1.7.8/<version>
/<dependency>
<dependency>
<groupid>com.sun.xml.messaging.saaj/<groupid>
<artifactid>saaj-impl/<artifactid>
<version>1.3.28/<version>
/<dependency>
<dependency>
<groupid>javax.xml.soap/<groupid>
<artifactid>javax.xml.soap-api/<artifactid>
<version>1.3.8/<version>
/<dependency>
<dependency>
<groupid>javax.xml.ws/<groupid>
<artifactid>jaxws-api/<artifactid>
<version>2.3.0/<version>
/<dependency>
/<dependencies>

除了一般的Java 11支持外,這兩個Spring Web Services版本還都帶來了一系列的Bug修復和改進,例如:

  • SaajSoapMessage創建時帶有默認的(空的)SoapEnvelope(SWS-1018) ;
  • SimpleXsdSchema不初始化產生NullPointerException(SWS-1036)的屬性;
  • 解決第三方庫版本衝突(SWS-1030);
  • Ehcache——OWASP依賴項檢查問題(SWS-1033)。

Spring Web Services 3.0.4.RELEASE特有的特性包括:

  • 使SimpleXsdSchema提供更有效的錯誤信息(SWS-1037);
  • 改進文檔,一系列對於文檔的小幅修正,如錯誤引用(應該指向Maven Wrapper而錯誤地指向了Gradle Wrapper的)、失效連接等等(SWS-1038);
  • 升級到Spring的最新版本(SWS-1039)。

Spring Web Services工件位於maven中心庫中和http://repo.spring.io/網站上。Spring GitHub庫中還提供了一個例子,演示如何搭配使用Spring Web Services和Spring Boot。

查看英文原文:Spring Releases Versions 3.0.4 and 2.4.3 Web Services


分享到:


相關文章: