Spring Web Services 3.0.4.RELEASE和2.4.3.RELEASE釋出
Spring同時ofollow,noindex" target="_blank">釋出 了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>
仍然使用Spring Web Services 2.4.3.RELEASE的開發人員使用Java 11時不會有問題。這個版本只是使用了稍微舊一點的SOAP/">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>
除了一般的Java 11支援外,這兩個Spring Web Services版本還都帶來了一系列的Bug修復和改進,例如:
- SaajSoapMessage建立時帶有預設的(空的)SoapEnvelope(SWS-1018 ) ;
- SimpleXsdSchema不初始化產生NullPointerException(SWS-1036 )的屬性;
- 解決第三方庫版本衝突(SWS-1030 );
Spring Web Services 3.0.4.RELEASE特有的特性包括:
- 使SimpleXsdSchema提供更有效的錯誤資訊(SWS-1037 );
- 升級到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