Upload
pivotal
View
154
Download
7
Embed Size (px)
Citation preview
A Sneak Peek at Spring Boot 2.0
By Madhura Bhave / Phil Webb
@madhurabhave23 / @phillip_webb
1
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
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
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
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
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
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
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
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
😀
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
😱 🐌
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
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
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
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
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
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
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));
}));
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
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
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
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
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
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
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
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
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
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
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
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
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
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)
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
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
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
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