SpringOne Platform 2017
Phil Webb, Pivotal
"Spring Boot 2.0 introduces a host of new features and whole lot of behind the scenes changes. This talk will cover all the major improvements, show you how to migrate and Boot 1.5 application and discuss some of the smaller tweaks and utilities that you might not be aware of.
We'll also cover some of the changes we made to the Spring Boot internals, discuss why we made them, and how they will help with future releases."
1. A Sneak Peek at Spring Boot 2.0
By Madhura Bhave / Phil Webb
@madhurabhave23 / @phillip_webb
1
2. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/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
3. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Whatâs New
⢠Infrastructure upgrades
⢠Spring Framework 5
3
4. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Whatâs New
⢠Infrastructure upgrades
⢠Spring Framework 5
4
5. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Infrastructure Upgrades
5
8+ 8+
5.23
6. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Whatâs New
⢠Infrastructure Upgrades
⢠Spring Framework 5
6
7. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Framework 5
⢠Reactive Spring
⢠Functional APIs
⢠Kotlin support
7
8. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Framework 5
⢠Reactive Spring
⢠Functional APIs
⢠Kotlin support
8
9. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Reactive Spring
9
đ
10. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Reactive Spring
10
đą đ
11. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/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
12. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Reactive Spring
Servlet Stack
⢠Servlet container
⢠Servlet API
⢠Spring MVC
Reactive Stack
⢠Netty, Servlet 3.1, Undertow
⢠Reactive HTTP layer (Reactive Streams)
⢠Spring WebFlux
12
13. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Reactive Spring
13
Mono<T> Flux<T>
Reactive Streams
Project Reactor
14. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ 14
Demo
15. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/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
16. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Framework 5
⢠Reactive Spring
⢠Functional APIs
⢠Kotlin support
16
17. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/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));
}));
18. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Framework 5
⢠Reactive Spring
⢠Functional APIs
⢠Kotlin Support
18
19. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Whatâs Changed
⢠Configuration properties
⢠Gradle plugin
⢠Actuator endpoints
19
20. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Whatâs Changed
⢠Configuration properties
⢠Gradle plugin
⢠Actuator endpoints
20
21. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/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-world
my.foo.helloWorld
my.foo.hello_world
my.foo.helloworld
22. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/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
23. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ 23
Demo
24. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Whatâs Changed
⢠Configuration properties
⢠Gradle plugin
⢠Actuator endpoints
24
25. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/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
26. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Whatâs Changed
⢠Configuration properties
⢠Gradle plugin
⢠Actuator endpoints
26
27. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Actuator Endpoints
⢠Endpoint annotations
â˘@Endpoint, @WebEndpoint, @JmxEndpoint
⢠Tech independent operations
â˘@ReadOperation, @WriteOperation, @DeleteOperation
⢠Tech specific extensions
â˘@EndpointWebExtension, @EndpointJmxExtension
27
28. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Actuator Endpoints
⢠Works with:
⢠Spring MVC
⢠Jersey
⢠Spring WebFlux
⢠Reactive health indicators
28
29. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Whatâs Evolving
⢠Metrics
⢠Security
29
30. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Whatâs Evolving
⢠Metrics
⢠Security
30
31. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/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)
32. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Whatâs Evolving
⢠Metrics
⢠Security
32
33. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/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
34. Unless otherwise indicated, these slides are Š 2013 -2017 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/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