Dan Vega
Spring Developer Advocate
Spring Boot 3
& Beyond
© 2020 Spring. A VMware-backed project.
Cover w/ Image
About Me
● Husband & Father
● Cleveland, OH
● Software Developer 22+ Years
● Spring Developer Advocate
● Content Creator www.danvega.dev
● Writing - Blog & Newsletter
● YouTuber
● @therealdanvega
Cover w/ Image
A new generation of Spring for 2023 and beyond
● Spring Boot 3
● JDK 17+
● Jakarta EE 9 / 10 (Jakarta namespace)
● AOT (Ahead-Of-Time) Compilation
● Observability (Micrometer)
● But wait, there's more!
● Spring Boot 3.1
● Docker Compose Module
● Spring Boot 3.2
● Virtual Threads (“Project Loom”)
Spring Boot 3.0
Java and Jakarta
Baseline: JDK 17 LTS
Language: text blocks, switch expressions
Core libraries: collection factory methods, etc
Type system: records, sealed classes
Module system: module introspection, module path scanning
Performance Improvements
Security Updates
Empowering the framework as well as applications
JDK 17 / 20 / 21
Spring generally embraces the latest JDK/JVM versions
JDK 17 baseline retained for long-term support purposes
E.g. in JDK 20: virtual threads, record patterns (preview)
JDK 21 on the horizon as next long-term support release
Consider upgrading your JDK along with Spring Framework 6.x
Baseline: Jakarta EE 9
A new namespace: Java EE 8 → Jakarta EE 9
Servlet API 5.0 : javax.servlet → jakarta.servlet
JPA 3.0 : javax.persistence → jakarta.persistence
Bean Validation 3.0 : javax.validation → jakarta.validation
Dependency Injection 2.0 : javax.inject → jakarta.inject
All further API evolution to happen in jakarta namespace
Migrating with the help of IDEs & Tools
Jakarta EE 9 / 10
Tomcat 10.0 / 10.1 – Servlet API 5.0 / 6.0
Jetty 11 / 12 – Servlet API 5.0 / 6.0
Undertow 2.3 – Servlet API 6.0
Hibernate ORM 6.1 – JPA 3.0 / 3.1
Hibernate Validator 7.0 / 8.0 – Bean Validation 3.0
Note: API upgrades not coupled to major provider versions anymore!
Ahead-of-Time
What is it?
● What is Ahead of Time Compilation?
● Java is a dynamic language
● Runtime hints for reflection, resources, serialization, proxies
● Precondition for GraalVM native executables
● Reducing startup time and memory footprint in production
● AOT is a tradeoff; extra build setup and less flexibility at runtime
Why Compile to Native?
Use Cases for Native Images
Observability
Observability
Observability is the ability to observe the internal state of a running
system from the outside. It consists of the three pillars logging, metrics
and traces.
Direct Observability instrumentation with Micrometer Observation in
several parts of the Spring Framework.
RestTemplate and WebClient are instrumented to produce HTTP client
request observations.
Spring Cloud Sleuth no longer needed for Distributed Tracing
Observation API
Spring Boot 3 - But wait there’s more!
HTTP Interface Client
RFC 7807 Problem Details
Spring Data 2022
Spring Security 6
Spring Authorization Server 1.0
Spring for GraphQL 1.1
More
Spring Boot 3.1
Spring Boot 3.1
Using Testcontainers at Development Time
Docker Compose spring-boot-docker-compose module
Auto-Configuration for Spring Authorization Server
Building Docker Images with Maven or Gradle
Spring for GraphQL 1.2
Dependency Upgrades
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.1-Release-Notes
Docker Compose Module
Demo
Spring Boot 3.2
Project Loom / Virtual Threads
What is a Thread in Java
● Java is Multithreaded by default
● java.lang.Thread
● Abstraction over operating system threads
● Every thread is essentially a wrapper over an OS thread
● OS/JVM thread = platform thread
● Platform threads are expensive
● Take a lot of memory / take time to create & destroy
● Traditional threads are stored on the JVM stack
Project Loom is to intended to explore,
incubate and deliver Java VM features and
APIs built on top of them for the purpose of
supporting easy-to-use, high-throughput
lightweight concurrency and new
programming models on the Java platform.
Project Loom
Project Loom includes the following JEPs.
● JEP 425: Virtual Threads (Preview) was integrated in JDK 19
● JEP 428: Structured Concurrency (Incubator) was integrated in JDK 19.
● JEP 429: Scoped Values (Incubator) has been integrated for JDK 20.
“Project Loom” Virtual Threads
Virtual Threads
● JDK 19 includes Virtual Threads as a Preview Feature
● Targeted for JDK 21
● Not Linked to an OS thread
● Use the heap for the stack (potential implications for GC)
● Have their own scheduler
● Created for a task and then allowed to terminate
● Do not pool virtual threads
Thread-Per-Request
Virtual Threads &
Spring Applications
Embracing Virtual Threads in Spring Applications
Web Applications.
● Servlet callback based on Input / Output Stream
● Tomcat / Jetty Executor setup for dispatching to request handlers
● “Loom-ready” database drivers, scalable connection pool setup
● Ideally no code changes in the main application codebase
● Virtual threads supported in GraalVM Native Image as well
● Significant scalability benefits for database driven web applications
Embracing Virtual Threads in Spring Applications
Messaging / Scheduling
● Spring managed task executors with virtual thread options
● JMS Message Listener containers
● @Scheduled handler methods
● Many of those listeners and handlers methods trigger I/O operations
Embracing Virtual Threads in Spring Applications
Where it doesn’t make sense
● Purely CPU bound handler methods
● Reactive based web applications
Virtual Threads
Loom vs Reactive Programming
● Virtual Threads provide a different scalability mechanism
● Traditional imperative programming style
● Empowering Spring MVC to reach maximum scalability
● Spring Webflux as an architecture for stream based processing
● Reactive: Stream based processing not primarily for scalability (anymore)
Demo
Spring Framework 6.0 – available now
Foundation for Spring Boot 3.0 & 3.1
Production-ready on JDK 17 LTS
Regular stream of 6.0.x releases in 2023
Spring Framework 6.1 – November 2023
Foundation for Spring Boot 3.2 & 3.3
Production-ready on JDK 17 & 21 LTS
Release candidate expected in October 2023
Thank you
Contact me at dvega@vmware.com
@therealdanvega
Copyright © 2020 VMware, Inc. or its affiliates.

Spring Boot 3 And Beyond

  • 1.
    Dan Vega Spring DeveloperAdvocate Spring Boot 3 & Beyond © 2020 Spring. A VMware-backed project.
  • 2.
    Cover w/ Image AboutMe ● Husband & Father ● Cleveland, OH ● Software Developer 22+ Years ● Spring Developer Advocate ● Content Creator www.danvega.dev ● Writing - Blog & Newsletter ● YouTuber ● @therealdanvega
  • 4.
    Cover w/ Image Anew generation of Spring for 2023 and beyond ● Spring Boot 3 ● JDK 17+ ● Jakarta EE 9 / 10 (Jakarta namespace) ● AOT (Ahead-Of-Time) Compilation ● Observability (Micrometer) ● But wait, there's more! ● Spring Boot 3.1 ● Docker Compose Module ● Spring Boot 3.2 ● Virtual Threads (“Project Loom”)
  • 5.
  • 6.
  • 8.
    Baseline: JDK 17LTS Language: text blocks, switch expressions Core libraries: collection factory methods, etc Type system: records, sealed classes Module system: module introspection, module path scanning Performance Improvements Security Updates Empowering the framework as well as applications
  • 9.
    JDK 17 /20 / 21 Spring generally embraces the latest JDK/JVM versions JDK 17 baseline retained for long-term support purposes E.g. in JDK 20: virtual threads, record patterns (preview) JDK 21 on the horizon as next long-term support release Consider upgrading your JDK along with Spring Framework 6.x
  • 10.
    Baseline: Jakarta EE9 A new namespace: Java EE 8 → Jakarta EE 9 Servlet API 5.0 : javax.servlet → jakarta.servlet JPA 3.0 : javax.persistence → jakarta.persistence Bean Validation 3.0 : javax.validation → jakarta.validation Dependency Injection 2.0 : javax.inject → jakarta.inject All further API evolution to happen in jakarta namespace
  • 11.
    Migrating with thehelp of IDEs & Tools
  • 12.
    Jakarta EE 9/ 10 Tomcat 10.0 / 10.1 – Servlet API 5.0 / 6.0 Jetty 11 / 12 – Servlet API 5.0 / 6.0 Undertow 2.3 – Servlet API 6.0 Hibernate ORM 6.1 – JPA 3.0 / 3.1 Hibernate Validator 7.0 / 8.0 – Bean Validation 3.0 Note: API upgrades not coupled to major provider versions anymore!
  • 13.
  • 14.
    What is it? ●What is Ahead of Time Compilation? ● Java is a dynamic language ● Runtime hints for reflection, resources, serialization, proxies ● Precondition for GraalVM native executables ● Reducing startup time and memory footprint in production ● AOT is a tradeoff; extra build setup and less flexibility at runtime
  • 15.
  • 16.
    Use Cases forNative Images
  • 17.
  • 18.
    Observability Observability is theability to observe the internal state of a running system from the outside. It consists of the three pillars logging, metrics and traces. Direct Observability instrumentation with Micrometer Observation in several parts of the Spring Framework. RestTemplate and WebClient are instrumented to produce HTTP client request observations. Spring Cloud Sleuth no longer needed for Distributed Tracing
  • 19.
  • 20.
    Spring Boot 3- But wait there’s more! HTTP Interface Client RFC 7807 Problem Details Spring Data 2022 Spring Security 6 Spring Authorization Server 1.0 Spring for GraphQL 1.1 More
  • 21.
  • 22.
    Spring Boot 3.1 UsingTestcontainers at Development Time Docker Compose spring-boot-docker-compose module Auto-Configuration for Spring Authorization Server Building Docker Images with Maven or Gradle Spring for GraphQL 1.2 Dependency Upgrades https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.1-Release-Notes
  • 23.
  • 26.
  • 27.
  • 28.
    Project Loom /Virtual Threads
  • 29.
    What is aThread in Java ● Java is Multithreaded by default ● java.lang.Thread ● Abstraction over operating system threads ● Every thread is essentially a wrapper over an OS thread ● OS/JVM thread = platform thread ● Platform threads are expensive ● Take a lot of memory / take time to create & destroy ● Traditional threads are stored on the JVM stack
  • 30.
    Project Loom isto intended to explore, incubate and deliver Java VM features and APIs built on top of them for the purpose of supporting easy-to-use, high-throughput lightweight concurrency and new programming models on the Java platform.
  • 31.
    Project Loom Project Loomincludes the following JEPs. ● JEP 425: Virtual Threads (Preview) was integrated in JDK 19 ● JEP 428: Structured Concurrency (Incubator) was integrated in JDK 19. ● JEP 429: Scoped Values (Incubator) has been integrated for JDK 20.
  • 32.
    “Project Loom” VirtualThreads Virtual Threads ● JDK 19 includes Virtual Threads as a Preview Feature ● Targeted for JDK 21 ● Not Linked to an OS thread ● Use the heap for the stack (potential implications for GC) ● Have their own scheduler ● Created for a task and then allowed to terminate ● Do not pool virtual threads
  • 33.
  • 39.
  • 40.
    Embracing Virtual Threadsin Spring Applications Web Applications. ● Servlet callback based on Input / Output Stream ● Tomcat / Jetty Executor setup for dispatching to request handlers ● “Loom-ready” database drivers, scalable connection pool setup ● Ideally no code changes in the main application codebase ● Virtual threads supported in GraalVM Native Image as well ● Significant scalability benefits for database driven web applications
  • 41.
    Embracing Virtual Threadsin Spring Applications Messaging / Scheduling ● Spring managed task executors with virtual thread options ● JMS Message Listener containers ● @Scheduled handler methods ● Many of those listeners and handlers methods trigger I/O operations
  • 42.
    Embracing Virtual Threadsin Spring Applications Where it doesn’t make sense ● Purely CPU bound handler methods ● Reactive based web applications
  • 43.
    Virtual Threads Loom vsReactive Programming ● Virtual Threads provide a different scalability mechanism ● Traditional imperative programming style ● Empowering Spring MVC to reach maximum scalability ● Spring Webflux as an architecture for stream based processing ● Reactive: Stream based processing not primarily for scalability (anymore)
  • 44.
  • 45.
    Spring Framework 6.0– available now Foundation for Spring Boot 3.0 & 3.1 Production-ready on JDK 17 LTS Regular stream of 6.0.x releases in 2023
  • 46.
    Spring Framework 6.1– November 2023 Foundation for Spring Boot 3.2 & 3.3 Production-ready on JDK 17 & 21 LTS Release candidate expected in October 2023
  • 47.
    Thank you Contact meat dvega@vmware.com @therealdanvega Copyright © 2020 VMware, Inc. or its affiliates.