領先一步
VMware 提供培訓和認證,以加速您的進展。
了解更多我們很高興宣布發布 Spring IO 1.0!
Spring IO 首先是一個邏輯描述,描述許多使用者已經知道並使用,以 Spring 為中心,成為單一、具凝聚力、協調的平台。
Spring IO 平台包含基礎層模組和執行層特定領域運行時 (DSR)。 基礎層代表核心 Spring 模組和相關的第三方相依性,這些模組和相依性經過協調,以確保順暢的開發體驗。 Spring IO 執行層提供的 DSR 大幅簡化了建構可立即用於生產的、基於 JVM 的工作負載。 Spring IO 的第一個版本包含兩個 DSR:Spring Boot 和 Grails。 Spring XD 將於 2014 年稍晚加入 Spring IO 平台。
Spring 支援許多應用程式工作負載。 想要與資料儲存庫互動嗎? 大型或專用資料儲存庫? 建置 批次處理解決方案? 整合不同的系統和資料? 使用 AMQP? 使用 Groovy 程式設計語言 以 Grails 快速建置網路應用程式? 連線到 OAuth 保護的 REST 服務,例如 Twitter、Facebook 或實際上 任何 OAuth 保護的服務? 保護應用程式? 使用 REST、websockets 等建置網路應用程式? (使用 HATEOAS?) 連線到您最愛的 平台即服務 (Platform-as-a-Service,例如 Cloud Foundry) 上的基礎結構服務? 需要管理快速、反應式、並行、訊息和事件分派? 公開 SOAP 驅動的網路服務? 我需要繼續說下去嗎? 如果您知道去哪裡尋找,很可能會有適合您的解決方案!
透過 Spring Boot,可以輕鬆地將這些模組 (以及其他更多模組!) 整合到由慣例驅動的解決方案中。 Spring Boot 是啟動和簡化持續應用程式開發的好方法。
BOM
中的平台Spring IO 平台也是透過 Maven 材料清單相依性的 API 的實際協調。 現在可以輕鬆推斷整個產品組合中哪些版本的哪些相依性可以一起運作。 如果您想要取得最新和最棒的 API 修訂版本,只需更新您的 Spring IO 相依性即可。 作為一個平台,Spring IO 也指定了已知可運作的熱門第三方程式庫 (例如 Hibernate) 的修訂版本。
Spring IO 最終只是應用程式 CLASSPATH
上的程式庫。 您可以使用建置工具的 <dependencyManagement/>
設施,選擇使用特定版本的相依性。 版本管理最終只是一種建議和便利,而不是要求。
Spring IO 經過認證可與 Java 1.7 和 1.8 搭配使用,儘管 Spring IO 下的特定專案通常也適用於更舊的 JDK。 它只需要 Java SE,並支援 Groovy、Grails 和一些 Java EE。 作為一個平台,它可以部署在嵌入式運行時、傳統應用程式伺服器部署和 PaaS 環境中。
以下是如何使用 Spring IO 的範例。 這是一個簡單的 Spring Boot REST 端點,執行時,會回應 http://127.0.0.1:8080/hello/SpringIO
形式的 HTTP 請求。
hi/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>your-application</artifactId>
<version>1.0.0-SNAPSHOT</version>
<!-- our one dependency on Spring Boot's web support. No version. -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<!-- Transitively bring in the Spring IO Platform Bill-of-Materials `pom.xml` -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>1.0.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
hi/src/main/java/io/Application.java
package io;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Configuration
@EnableAutoConfiguration
@RestController
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@RequestMapping("/hello/{name}")
String hi(@PathVariable String name) {
return "Hello, " + name + "!";
}
}
在 詳盡的 Spring IO 文件中還有更多內容要說和閱讀。 它包含更多範例,並涵蓋 Gradle。