我们一直在为我们的应用程序使用Springboot 1.X. 现在正准备开始一些新的应用程序,并想知道我们是否应该使用SpringBoot2.0或坚持使用SpringBoot 1.X?
关于这种或那种方式的任何想法?另外,Spring Boot 1.X与Spring Boot 2.0有什么区别?
谢谢.
小智 13
您可以在此处找到差异和迁移指南:https: //github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide
等等..
Put*_*tti 11
SpringBoot 2.*更改:
1. Java 8是最低版本
2. Tomcat 8.5版是最低的
3. Hibernate 5.2版是最低的
4. Gradle 3.4版是最低的
5.为WebFlux添加了SpringBoot Starters,并为Cassandra,MongoDB和Redis提供了反应支持.
6. 自动配置
一个.安全性(需要添加一个bean来暴露执行器端点,如健康等)
示例代码:(根据您的需要修改以下代码)
@Configuration
public class ApplicationSecurity extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) throws Exception {
web
.ignoring()
.antMatchers("/**");
}
}
Run Code Online (Sandbox Code Playgroud)
b.需要添加spring-boot-starter-security依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
执行器端点更改:
2.*:http:// localhost:8080/business-customer/profile / env将提供详细信息.
从2.*:http:// localhost:8080/business-customer/profile / actuator/env将提供详细信息.
端点属性在application.properties(使所有端点)
management.endpoints.web.exposure.include =*management.endpoints.web.exposure.exclude = loggers
默认情况下连接池:
之前2.*:tomcat CP
2.后:HikariCP(从SpringBoot 2.你并不需要添加HikariCP依赖,其配置bean创建及其属性的变化.)
迁移:https: //spring.io/blog/2018/03/12/upgrading-start-spring-io-to-spring-boot-2
| 归档时间: |
|
| 查看次数: |
11609 次 |
| 最近记录: |