Spring boot 2.x----------1简介

1 与spring不同

1 微服务
2 响应式
在这里插入图片描述

3 clound
4 serverless Fass 无需计算资源
5 batch 批处理
6 事件驱动

2 springboot2.0新特性

官方文档 https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Release-Notes
1 Java 8 Baseline and Java 9 Support

2 Third-party Library Upgrades
Tomcat 8.5

Flyway 5

Hibernate 5.2

Thymeleaf 3

3 Reactive Spring

Spring Boot 2.0 fully supports reactive applications via auto-configuration and starter-POMs. The internals of Spring Boot itself have also been updated where necessary to offer reactive alernatives (the most noticeable being our embedded server support).

Spring WebFlux & WebFlux.fn

3 Reactive Spring Data
Where the underlying technology enables it, Spring Data also provides support for reactive applications. Currently Cassandra, MongoDB, Couchbase and Redis all have reactive API support.

Spring Boot includes special starter-POMs for these technologies that provide everything you need to get started. For example, spring-boot-starter-data-mongodb-reactive includes dependencies to the reactive mongo driver and project reactor.

4 Reactive Spring Security
Spring Boot 2.0 can make use of Spring Security 5.0

5 Embedded Netty Server

6 Note
You can only use Netty as a reactive server. Blocking servlet API support is not provided.
HTTP/2 Support
HTTP/2 support is provided for Tomcat, Undertow and Jetty. Support depends on the chosen web server and the application environment (since the protocol is not supported out-of-the-box by JDK 8).

7 Configuration Property Binding
The mechanism use to bind Environment properties to @ConfigurationProperties has been completely overhauled in Spring Boot 2.0. We’ve taken the opportunity to tighten the rules that govern relaxed binding and we’ve fixed many inconsistencies from Spring Boot 1.x.

The new Binder API can also be used outside of @ConfigurationProperties directly in your own code. For example, the following will bind to a List of PersonName objects:

8 Property Origins
YAML files and Properties files loaded by Spring Boot now include Origin information which can help you track where an item was loaded from. Several Spring Boot features take advantage of this information and show it when appropriate.
9 Converter Support
Binding makes use of a new ApplicationConversionService class which offers some additional converters which are especially useful for property binding. Most noticeable are converters for Duration types and delimited strings.

10 Gradle Plugin
Spring Boot’s Gradle plugin has been largely rewritten to enable a number of significant improvements. You can read more about the plugin’s capabilities in its reference and api documentation.

Spring Boot now requires Gradle 4.x. Please check the migration guide if you’re upgrading a project that uses Gradle.

11 Kotlin
Spring Boot 2.0 now includes support for Kotlin 1.2.x and offers a runApplication function which provides a way to run a Spring Boot application using idiomatic Kotlin. We also expose and leverage the Kotlin support that other Spring projects such as Spring Framework, Spring Data, and Reactor have added to their recent releases.

12 Actuator JSON
The JSON payloads returned from many endpoints have been improved with Spring Boot 2.0.

Many endpoints now have JSON that more accurately reflects the underlying data. For example, the /actuator/conditions endpoint (/autoconfig in Spring Boot 1.5) now has a top level contexts key to group results by ApplicationContext.

13 Actuator @Endpoints
In order to support Spring MVC, JMX, WebFlux and Jersey, we’ve developed a new programming model for actuator endpoints. The @Endpoint annotation can be used in combination with @ReadOperation, @WriteOperation and @DeleteOperation to develop endpoints in a technology agnostic way.

You can also use @EndpointWebExtension or @EndpointJmxExtension to write technology specific enhancements to endpoints. See the updated reference documentation for details.

14 Micrometer
Spring Boot 2.0 no longer ships with its own metrics APIs. Instead we rely on micrometer.io for all application monitoring needs.

15 Data Support
In addition the “Reactive Spring Data” support mentioned above, several other updates and improvements have been made in the area of Data.

16 Influx DB
Spring Boot now auto-configures the open-source time series database InfluxDB. To enable InfluxDB support you need to set a spring.influx.url property, and include influxdb-java on your classpath.

Flyway/Liquibase Flexible Configuration

Hibernate

Redis
Cache defaults for Redis can now be configured using spring.cache.redis.* properties.

Web
In addition to the WebFlux and WebFlux.fn support mentioned above, the following refinements have also been made to help when developing web applications.

Context Path Logging
When using an embedded container, the context path is logged alongside the HTTP port when your application starts. For a example, embedded Tomcat now looks something like this:

Tomcat started on port(s): 8080 (http) with context path ‘/foo’
Web Filter Initialization
Web filters are now initialized eagerly on all supported containers.

17 Thymeleaf
The Thymeleaf starter now includes thymeleaf-extras-java8time which provides support for javax.time types.

1 8 Quartz
Auto-configuration support is now include for the Quartz Scheduler. We’ve also added a new spring-boot-starter-quartz starter POM.

You can use in-memory JobStores, or a full JDBC-based store. All JobDetail, Calendar and Trigger beans from your Spring application context will be automatically registered with the Scheduler.

19 Testing
There have been a few additions and tweaks to the testing support provided in Spring Boot 2.0:

A new @WebFluxTest annotation has been added to support “slice” testing of WebFlux applications.

Converter and GenericConverter beans are now automatically scanned with @WebMvcTest and @WebFluxTest.

An @AutoConfigureWebTestClient annotation had been added to provide a WebTestClient bean for tests to use. The annotation is automatically applied to @WebFluxTest tests.

20 Miscellaneous
As well as the changes listed above, there have also been lots of minor tweaks and improvements including:

3 主要功能

3.1 依赖管理

官方:spring-boot-starter-*
一共多少种?https://docs.spring.io/spring-boot/docs/current/reference/html/using-spring-boot.html#using-boot-starter
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

第三方:thirdpartyproject-spring-boot-starter.

3.2 自动配置

1 自动配好Tomcat

2 自动配好SpringMVC

• 引入SpringMVC全套组件
• 自动配好SpringMVC常用组件(功能)

3 自动配好Web.xml,如:字符编码filter
4 SpringBoot帮我们配置好了所有web开发的常见场景
5 默认的包结构

• 主程序所在包及其下面的所有子包里面的组件都会被默认扫描进来
• 无需以前的包扫描配置
• 想要改变扫描路径,@SpringBootApplication(scanBasePackages=“com.atguigu”)
• 或者@ComponentScan 指定扫描路径

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值