what's new in spring boot 2.0
TRANSCRIPT
![Page 1: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/1.jpg)
A Sneak Peek at Spring Boot 2.0
By Madhura Bhave / Phil Webb
@madhurabhave23 / @phillip_webb
1
![Page 2: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/2.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Agenda
• What’s New• Infrastructure upgrades
• Spring Framework 5
• What’s Changed• Configuration properties
• Gradle plugin
• Actuator endpoints
• What’s Evolving• Security
• Metrics
2
![Page 3: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/3.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
What’s New
• Infrastructure upgrades
• Spring Framework 5
3
![Page 4: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/4.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
What’s New
• Infrastructure upgrades
• Spring Framework 5
4
![Page 5: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/5.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Infrastructure Upgrades
5
8+ 8+
5.23
![Page 6: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/6.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
What’s New
• Infrastructure Upgrades
• Spring Framework 5
6
![Page 7: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/7.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Spring Framework 5
• Reactive Spring
• Functional APIs
• Kotlin support
7
![Page 8: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/8.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Spring Framework 5
• Reactive Spring
• Functional APIs
• Kotlin support
8
![Page 9: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/9.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Reactive Spring
9
😀
![Page 10: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/10.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Reactive Spring
10
😱 🐌
![Page 11: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/11.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Reactive Spring
Blocking
• Large thread pool required
• Each request gets its own thread
Non-Blocking
• Small thread pool
• Worker threads process events
11
![Page 12: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/12.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Reactive SpringServlet Stack
• Servlet container
• Servlet API
• Spring MVC
Reactive Stack
• Netty, Servlet 3.1, Undertow
• Reactive HTTP layer (Reactive Streams)
• Spring WebFlux
12
![Page 13: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/13.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Reactive Spring
13
Mono<T> Flux<T>
Reactive Streams
Project Reactor
![Page 14: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/14.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /14
Demo
![Page 15: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/15.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Reactive Spring
• Non-blocking
• Event driven at the center
• More for scalability than speed
• You can still use Spring MVC
15
![Page 16: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/16.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Spring Framework 5
• Reactive Spring
• Functional APIs
• Kotlin support
16
![Page 17: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/17.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Functional APIs
17
RouterFunction<?> route = route(GET("/person/{id}"),
request -> {
Mono<Person> person = Mono.justOrEmpty(request.pathVariable("id"))
.map(Integer::valueOf)
.then(repository::getPerson);
return ServerResponse.ok().body(fromPublisher(person, Person.class));
})
.and(route(GET("/person"),
request -> {
Flux<Person> people = repository.allPeople();
return ServerResponse.ok().body(fromPublisher(people, Person.class));
}))
.and(route(POST("/person"),
request -> {
Mono<Person> person = request.body(toMono(Person.class));
return ServerResponse.ok().build(repository.savePerson(person));
}));
![Page 18: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/18.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Spring Framework 5
• Reactive Spring
• Functional APIs
• Kotlin Support
18
![Page 19: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/19.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
What’s Changed
• Configuration properties
• Gradle plugin
• Actuator endpoints
19
![Page 20: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/20.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
What’s Changed
• Configuration properties
• Gradle plugin
• Actuator endpoints
20
![Page 21: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/21.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Configuration Properties• Relaxed binding rules stay the same
• Uniform format for reading properties from the environment• Elements separated by dots
• Must be alpha-numeric
• Must be lowercase
• Hyphen can be used to separate words
21
my.foo.hello-worldmy.foo.helloWorldmy.foo.hello_world
my.foo.helloworld
![Page 22: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/22.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Configuration Properties
• Indices in environment variables
MY_VAR_1=a my.var[1]
MY_VAR_1_2=b my.var[1][2]
• Consistent behavior for Collections
• Better types, e.g. Duration “1s” “2m” “5d”
• Origin support
22
![Page 23: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/23.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /23
Demo
![Page 24: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/24.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
What’s Changed
• Configuration properties
• Gradle plugin
• Actuator endpoints
24
![Page 25: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/25.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Gradle Plugin•bootRepackage replaced by bootJar & bootWar
• Tasks do not figure out what to do
• Plugin configures the tasks with sensible defaults
• Reacts to other plugins
• Explicit dependency management
25
![Page 26: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/26.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
What’s Changed
• Configuration properties
• Gradle plugin
• Actuator endpoints
26
![Page 27: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/27.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Actuator Endpoints
• Endpoint annotations
•@Endpoint, @WebEndpoint, @JmxEndpoint
• Tech independent operations
•@ReadOperation, @WriteOperation, @DeleteOperation
• Tech specific extensions
•@EndpointWebExtension, @EndpointJmxExtension
27
![Page 28: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/28.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Actuator Endpoints
• Works with:
• Spring MVC
• Jersey
• Spring WebFlux
• Reactive health indicators
28
![Page 29: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/29.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
What’s Evolving
• Metrics
• Security
29
![Page 30: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/30.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
What’s Evolving
• Metrics
• Security
30
![Page 31: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/31.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Metrics
• Auto-configuration for metrics instrumentation by Micrometer *
• Hierarchical metrics replaced by dimensional metrics
• Facade over multiple monitoring systems
31
* Introducing Micrometer Application Metrics - (Thursday 10:30am)
![Page 32: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/32.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
What’s Evolving
• Metrics
• Security
32
![Page 33: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/33.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Security
• Simpler security auto-configuration
• Auto-configuration backs-off easily
• Adding custom security is easy
• No ordering issues with WebSecurityConfigurerAdapter
• RequestMatchers for static resources and actuators
• Web actuator endpoints have consistent behavior
33
![Page 34: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/34.jpg)
Unless o therwise ind ica ted, these s l ides a re © 2013 -2017 P ivo ta l So f tware , Inc . and l i censed under a Crea t ive Commons
At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / / c rea t ivecommons.org/ l i censes/by -nc /3 .0 /
Security
• OAuth 2.0
• Moving to Spring Security 5.0
• Support for multiple client registrations
• Authorization server/Resource server support
34
![Page 35: What's new in Spring Boot 2.0](https://reader031.vdocuments.mx/reader031/viewer/2022020314/5a64bfe57f8b9a76038b481f/html5/thumbnails/35.jpg)
Questions?
@madhurabhave23
@phillip_webb
#springone@s1p
https://github.com/mbhave/webflux-demo
https://github.com/mbhave/actuator-demo
https://github.com/mbhave/configuration-properties-demo