領先一步
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 快速構建 Web 應用程式? 連線到像 Twitter、Facebook 或 實際上 任何 OAuth 安全服務的 OAuth 安全 REST 服務? 保護應用程式的安全? 構建一個 具有 REST、websockets 等功能的 Web 應用程式? (使用 HATEOAS?) 連線到您喜歡的 平臺即服務 (例如 Cloud Foundry) 上的基礎架構服務? 需要 管理快速的、響應式的、併發的、訊息和事件分發? 公開 基於 SOAP 的 Web 服務? 我需要繼續說下去嗎? 如果您知道在哪裡查詢,很可能有一個適合您的解決方案!
使用 Spring Boot,可以很容易地將這些模組(以及更多的模組!)整合到由約定驅動的解決方案中。 Spring Boot 是引導和簡化持續應用開發的好方法。
BOM
中的平臺Spring IO 平臺也是透過 Maven Bill-of-Materials 依賴項對 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。