Spring IO Platform项目志在解决依赖包版本问题

官方定义

  • 原文

Spring IO is a cohesive, versioned platform for building modern applications. It is a modular, enterprise-grade distribution that delivers a curated set of dependencies while keeping developers in full control of deploying only the parts they need. Spring IO is 100% open source, lean, and modular.

  • 翻译

Spring IO 是一个用于构建现代应用程序的、有凝聚力的版本化平台。它是一个模块化的、企业级的分布,提供了一组策略依赖关系。同时,开发人员只需部署他们所需要的部分。Spring IO是100%开源、精益和模块化的项目。

  • 其是基于spring boot项目的版本管理,会整合更优、更稳定的spring boot的版本,节省我们测试依赖版本兼容时间。

为什么使用spring io platform

  • 在项目开发中,经常会使用到第三方库,一般情况大家都是根据经验、参考资料或直接选择较新的稳定版本,随意性较大。随着业务复杂度的增加,集成的第三方库会越来越多,依赖关系也会越来越复杂。除非做过完整的测试,保证集成第三方库的版本不会出问题,且后续集成或升级都不会出问题,否则就有可能存在较大的隐性风险(版本冲突)。
  • Spring IO Platform就能很好地帮助我们解决这些问题。开发人员在添加第三方库时,不需要关心版本号,Spring IO Platform会帮助我们提供一个最优的版本,而且该版本是经过严格测试的,可以更好地兼容其它的组件。同时,你也可以根据自己的需要来升级或降级依赖版本。

其主要特性

  • 一个平台,多种工作负载 - 构建Web,集成,批处理,响应式或大数据应用。
  • 通过Spring Boot从根本上简化开发体验。
  • 开箱即用。
  • 精心策划和协调一致的依赖关系。
  • 模块化平台,允许开发人员只部署他们所需的依赖。
  • 支持嵌入式、传统应用服务器和PaaS部署。
  • 只依赖Java SE,并且支持Groovy, Grails和一些Java EE。
  • 适用于存在的依赖管理工具,例如Maven和Gradle。
  • Spring IO Platform已通过JDK7和8以上的认证。

快速上手

使用时到官网选择合适版本,官网:https://spring.io/projects/platform#learn

目前发布版本有两个

  • Cairo-SR5: 是基于spring boot 2.0.6.RELEASE
  • Brussels-SR14:是基于spring boot 1.5.17.RELEASE

在maven项目中添加使用

  • pom`s parent
<?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>
    <parent>
        <groupId>io.spring.platform</groupId>
        <artifactId>platform-bom</artifactId>
        <version>Cairo-SR5</version>
        <relativePath/>
    </parent>
    <!-- Dependency declarations -->
</project>
  • dependency management
<?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>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.spring.platform</groupId>
                <artifactId>platform-bom</artifactId>
                <version>Cairo-SR5</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
<!-- Dependency declarations -->
</project>

Gradle的使用方式和Maven类似,在些不在说明

使用实例

在集成Spring IO Platform提供的依赖管理后,你仍然可以像以前一样添加第三方库,而且无需再关心依赖包的版本问题,这就是spring io platform的目的。

  • 简单应用实体
<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-redis</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		
		<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger2</artifactId>

</dependency>

<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger-ui</artifactId>

</dependency>

</dependencies>
  • 可能有人说这不是和spring-boot-starter-parent等类同么,为什么还要用spring io platform? 原因是前面只解决spring boot官方包版本问题,并未解决其实版本依赖问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值