SlideShare une entreprise Scribd logo
1  sur  10
Spring Framework 5: Hidden Gems
By Juergen Hoeller
@springjuergen
1
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Spring Framework 5.0 (Overview)
Embracing JDK 9 as well as Kotlin and Project Reactor
Driven by functional API design and reactive architectures
Major baseline upgrade: Java SE 8+, Java EE 7+
• JDK 8, Servlet 3.1, Bean Validation 1.1, JPA 2.1, JMS 2.0
• support for JUnit 5 (next to JUnit 4.12)
Comprehensive integration with Java EE 8 API level
• Servlet 4.0, Bean Validation 2.0, JPA 2.2, JSON Binding API 1.0
• e.g. Tomcat 9.0, Hibernate Validator 6.0, Apache Johnzon 1.1
2
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Commons Logging Bridge
“spring-jcl” as a custom Commons Logging bridge
• separate module within the Spring Framework umbrella
• the only required dependency of the spring-core module
First-class support for Log4j 2, SLF4J, and JUL (java.util.logging)
• Spring-style runtime detection of Log4J 2 and SLF4J providers
• strong integration with java.util.logging (location-aware LogRecord etc)
No custom bridges and no custom excludes in application POMs!
• streamlined setup of Log4j or Logback without extra bridge artifacts
• no exclude of standard “commons-logging” for “jcl-over-slf4j” anymore
3
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Build-Time Components Indexer
Classpath scanning on startup may be slow
• <context:component-scan> or @ComponentScan
• file system traversal of all packages within the specified base packages
The common solution: narrow your base packages
• Spring only searches within the specified roots in the classpath
• alternatively: fully enumerate your component classes (no scanning at all)
New variant in 5.0: a build-time annotation processor
• spring-context-indexer generates META-INF/spring.components per jar
• automatically used at runtime for compatible component-scan declarations
4
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Nullability
Comprehensive nullability declarations across the codebase
• non-null method parameters, method return values, fields by default
• individual @Nullable declarations for actually nullable return values etc
The Java effect: nullability validation in IntelliJ IDEA and Eclipse
• e.g. for “Constant conditions & exceptions” inspection in Intellij IDEA
• allowing us to catch subtle bugs/gaps in the framework's own codebase
• allowing applications to validate their own interaction with Spring APIs
The Kotlin effect: straightforward assignments to non-null variables
• Kotlin compiler only allows such assignments for APIs with clear nullability
5
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Data Class Binding
Spring data binding can work with immutable classes now
• traditional setter methods versus named constructor arguments
Property names matched against constructor parameter names
• explicit property names via @ConstructorProperties
• or simply inferred from class bytecode (-parameters or -debug)
Perfect match: Kotlin data classes and Lombok data classes
• data class Person(val name: String, val age: Int)
• @Data public class Person { private final String name; private final int age; }
6
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Programmatic Lookup via ObjectProvider
@Autowired ObjectProvider<MyBean> myBeanProvider
Original ObjectProvider methods (dating back to 4.3)
• @Nullable T getIfAvailable()
• @Nullable T getIfUnique()
New overloaded variants with java.util.function callbacks
• T getIfAvailable(Supplier<T> defaultSupplier)
• void ifAvailable(Consumer<T> dependencyConsumer)
• T getIfUnique(Supplier<T> defaultSupplier)
• void ifUnique(Consumer<T> dependencyConsumer)
7
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Refined Resource Interaction
Overhaul of Spring's Resource abstraction in core.io
• Resource.isFile()
• DefaultResourceLoader returns writable FileUrlResource for “file:”
Exposing NIO.2 API at the application level
• Resource.readableChannel()
• WritableResource.writableChannel()
Internally using NIO.2 file access wherever possible
• FileSystemResource.getInput/OutputStream()
• FileCopyUtils.copy(File, File)
8
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Asynchronous Execution
ListenableFuture interface with direct CompletableFuture support
• ListenableFuture.completable() returns CompletableFuture
• e.g. for futures returned from AsyncListenableTaskExecutor
TaskScheduler interface with alternative to Date and long arguments
• scheduleAtFixedRate(Runnable, Instant, Duration)
• scheduleWithFixedDelay(Runnable, Instant, Duration)
ScheduledTaskHolder interface for monitoring the current tasks
• ScheduledAnnotationBeanPostProcessor.getScheduledTasks()
• ScheduledTaskRegistrar.getScheduledTasks()
9
Learn More. Stay Connected.
Coming up: Spring Framework 5.0.3
Stay tuned for Spring Framework 5.1 next year…
10
#springone@s1p

Contenu connexe

Tendances

Spring boot
Spring bootSpring boot
Spring bootsdeeg
 
MicroProfile for MicroServices
MicroProfile for MicroServicesMicroProfile for MicroServices
MicroProfile for MicroServicesMert Çalışkan
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkHùng Nguyễn Huy
 
Introducing Spring Framework 5.3
Introducing Spring Framework 5.3Introducing Spring Framework 5.3
Introducing Spring Framework 5.3VMware Tanzu
 
Introduction to Ibatis by Rohit
Introduction to Ibatis by RohitIntroduction to Ibatis by Rohit
Introduction to Ibatis by RohitRohit Prabhakar
 
Android with dagger_2
Android with dagger_2Android with dagger_2
Android with dagger_2Kros Huang
 
Peering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for ObservabilityPeering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for ObservabilityVMware Tanzu
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC frameworkMohit Gupta
 
Lecture android best practices
Lecture   android best practicesLecture   android best practices
Lecture android best practiceseleksdev
 
MicroProfile: Optimizing Java EE for a Microservices Architecture
MicroProfile: Optimizing Java EE for a Microservices ArchitectureMicroProfile: Optimizing Java EE for a Microservices Architecture
MicroProfile: Optimizing Java EE for a Microservices Architecturejclingan
 
Ingress? That’s So 2020! Introducing the Kubernetes Gateway API
Ingress? That’s So 2020! Introducing the Kubernetes Gateway APIIngress? That’s So 2020! Introducing the Kubernetes Gateway API
Ingress? That’s So 2020! Introducing the Kubernetes Gateway APIVMware Tanzu
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenMert Çalışkan
 
Spring Framework
Spring FrameworkSpring Framework
Spring Frameworknomykk
 
Spring andspringboot training
Spring andspringboot trainingSpring andspringboot training
Spring andspringboot trainingMallikarjuna G D
 
Core Spring + Reactive 김민석
Core Spring + Reactive  김민석Core Spring + Reactive  김민석
Core Spring + Reactive 김민석VMware Tanzu Korea
 

Tendances (20)

Spring boot
Spring bootSpring boot
Spring boot
 
MicroProfile for MicroServices
MicroProfile for MicroServicesMicroProfile for MicroServices
MicroProfile for MicroServices
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Java spring ppt
Java spring pptJava spring ppt
Java spring ppt
 
Introducing Spring Framework 5.3
Introducing Spring Framework 5.3Introducing Spring Framework 5.3
Introducing Spring Framework 5.3
 
Introduction to Ibatis by Rohit
Introduction to Ibatis by RohitIntroduction to Ibatis by Rohit
Introduction to Ibatis by Rohit
 
Android with dagger_2
Android with dagger_2Android with dagger_2
Android with dagger_2
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 
Peering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for ObservabilityPeering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for Observability
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC framework
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Spring User Guide
Spring User GuideSpring User Guide
Spring User Guide
 
Lecture android best practices
Lecture   android best practicesLecture   android best practices
Lecture android best practices
 
MicroProfile: Optimizing Java EE for a Microservices Architecture
MicroProfile: Optimizing Java EE for a Microservices ArchitectureMicroProfile: Optimizing Java EE for a Microservices Architecture
MicroProfile: Optimizing Java EE for a Microservices Architecture
 
Ingress? That’s So 2020! Introducing the Kubernetes Gateway API
Ingress? That’s So 2020! Introducing the Kubernetes Gateway APIIngress? That’s So 2020! Introducing the Kubernetes Gateway API
Ingress? That’s So 2020! Introducing the Kubernetes Gateway API
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Spring andspringboot training
Spring andspringboot trainingSpring andspringboot training
Spring andspringboot training
 
Core Spring + Reactive 김민석
Core Spring + Reactive  김민석Core Spring + Reactive  김민석
Core Spring + Reactive 김민석
 

Similaire à Spring Framework 5.0: Hidden Gems

Spring Framework 5.2: Core Container Revisited
Spring Framework 5.2: Core Container RevisitedSpring Framework 5.2: Core Container Revisited
Spring Framework 5.2: Core Container RevisitedVMware Tanzu
 
Testing with Spring 4.x
Testing with Spring 4.xTesting with Spring 4.x
Testing with Spring 4.xSam Brannen
 
Informix Java Driver Improvements 4.10.JC8
Informix Java  Driver Improvements 4.10.JC8Informix Java  Driver Improvements 4.10.JC8
Informix Java Driver Improvements 4.10.JC8Brian Hughes
 
Java EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConJava EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConLudovic Champenois
 
Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking TourJoshua Long
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)Kevin Sutter
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Robert Scholte
 
Spring framework
Spring frameworkSpring framework
Spring frameworkvietduc17
 
Microservices made easy JavaCro 2021
Microservices made easy JavaCro 2021Microservices made easy JavaCro 2021
Microservices made easy JavaCro 2021Jamie Coleman
 
Contexts and Dependency Injection for the JavaEE platform
Contexts and Dependency Injection for the JavaEE platformContexts and Dependency Injection for the JavaEE platform
Contexts and Dependency Injection for the JavaEE platformBozhidar Bozhanov
 
Springboot2 postgresql-jpa-hibernate-crud-example with test
Springboot2 postgresql-jpa-hibernate-crud-example with testSpringboot2 postgresql-jpa-hibernate-crud-example with test
Springboot2 postgresql-jpa-hibernate-crud-example with testHyukSun Kwon
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크Yoonki Chang
 
CDI Best Practices with Real-Life Examples - TUT3287
CDI Best Practices with Real-Life Examples - TUT3287CDI Best Practices with Real-Life Examples - TUT3287
CDI Best Practices with Real-Life Examples - TUT3287Ahmad Gohar
 
Creating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with TestcontainersCreating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with TestcontainersPaul Balogh
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Rohit Kelapure
 
JCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptxJCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptxGrace Jansen
 
Running Java Applications on Cloud Foundry
Running Java Applications on Cloud FoundryRunning Java Applications on Cloud Foundry
Running Java Applications on Cloud FoundryVMware Tanzu
 
Spring Boot Workshop - January w/ Women Who Code
Spring Boot Workshop - January w/ Women Who CodeSpring Boot Workshop - January w/ Women Who Code
Spring Boot Workshop - January w/ Women Who CodePurnima Kamath
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9Ivan Krylov
 

Similaire à Spring Framework 5.0: Hidden Gems (20)

Spring Framework 5.2: Core Container Revisited
Spring Framework 5.2: Core Container RevisitedSpring Framework 5.2: Core Container Revisited
Spring Framework 5.2: Core Container Revisited
 
Testing with Spring 4.x
Testing with Spring 4.xTesting with Spring 4.x
Testing with Spring 4.x
 
Informix Java Driver Improvements 4.10.JC8
Informix Java  Driver Improvements 4.10.JC8Informix Java  Driver Improvements 4.10.JC8
Informix Java Driver Improvements 4.10.JC8
 
Java EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConJava EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseCon
 
Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking Tour
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Microservices made easy JavaCro 2021
Microservices made easy JavaCro 2021Microservices made easy JavaCro 2021
Microservices made easy JavaCro 2021
 
Contexts and Dependency Injection for the JavaEE platform
Contexts and Dependency Injection for the JavaEE platformContexts and Dependency Injection for the JavaEE platform
Contexts and Dependency Injection for the JavaEE platform
 
Introduction to Spring & Spring BootFramework
Introduction to Spring  & Spring BootFrameworkIntroduction to Spring  & Spring BootFramework
Introduction to Spring & Spring BootFramework
 
Springboot2 postgresql-jpa-hibernate-crud-example with test
Springboot2 postgresql-jpa-hibernate-crud-example with testSpringboot2 postgresql-jpa-hibernate-crud-example with test
Springboot2 postgresql-jpa-hibernate-crud-example with test
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크
 
CDI Best Practices with Real-Life Examples - TUT3287
CDI Best Practices with Real-Life Examples - TUT3287CDI Best Practices with Real-Life Examples - TUT3287
CDI Best Practices with Real-Life Examples - TUT3287
 
Creating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with TestcontainersCreating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with Testcontainers
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
 
JCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptxJCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptx
 
Running Java Applications on Cloud Foundry
Running Java Applications on Cloud FoundryRunning Java Applications on Cloud Foundry
Running Java Applications on Cloud Foundry
 
Spring Boot Workshop - January w/ Women Who Code
Spring Boot Workshop - January w/ Women Who CodeSpring Boot Workshop - January w/ Women Who Code
Spring Boot Workshop - January w/ Women Who Code
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
 

Plus de VMware Tanzu

What AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About ItWhat AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About ItVMware Tanzu
 
Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023VMware Tanzu
 
Enhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at ScaleEnhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at ScaleVMware Tanzu
 
Spring Update | July 2023
Spring Update | July 2023Spring Update | July 2023
Spring Update | July 2023VMware Tanzu
 
Platforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a ProductPlatforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a ProductVMware Tanzu
 
Building Cloud Ready Apps
Building Cloud Ready AppsBuilding Cloud Ready Apps
Building Cloud Ready AppsVMware Tanzu
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And BeyondVMware Tanzu
 
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdfSpring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdfVMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023VMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023VMware Tanzu
 
tanzu_developer_connect.pptx
tanzu_developer_connect.pptxtanzu_developer_connect.pptx
tanzu_developer_connect.pptxVMware Tanzu
 
Tanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - FrenchTanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - FrenchVMware Tanzu
 
Tanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - EnglishTanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - EnglishVMware Tanzu
 
Virtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - EnglishVirtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - EnglishVMware Tanzu
 
Tanzu Developer Connect - French
Tanzu Developer Connect - FrenchTanzu Developer Connect - French
Tanzu Developer Connect - FrenchVMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023VMware Tanzu
 
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring BootSpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring BootVMware Tanzu
 
SpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software EngineerSpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software EngineerVMware Tanzu
 
SpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs PracticeSpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs PracticeVMware Tanzu
 
SpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense SolutionsSpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense SolutionsVMware Tanzu
 

Plus de VMware Tanzu (20)

What AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About ItWhat AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About It
 
Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023
 
Enhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at ScaleEnhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at Scale
 
Spring Update | July 2023
Spring Update | July 2023Spring Update | July 2023
Spring Update | July 2023
 
Platforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a ProductPlatforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a Product
 
Building Cloud Ready Apps
Building Cloud Ready AppsBuilding Cloud Ready Apps
Building Cloud Ready Apps
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdfSpring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
 
tanzu_developer_connect.pptx
tanzu_developer_connect.pptxtanzu_developer_connect.pptx
tanzu_developer_connect.pptx
 
Tanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - FrenchTanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - French
 
Tanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - EnglishTanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - English
 
Virtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - EnglishVirtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - English
 
Tanzu Developer Connect - French
Tanzu Developer Connect - FrenchTanzu Developer Connect - French
Tanzu Developer Connect - French
 
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
 
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring BootSpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
 
SpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software EngineerSpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software Engineer
 
SpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs PracticeSpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs Practice
 
SpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense SolutionsSpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
 

Dernier

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Dernier (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

Spring Framework 5.0: Hidden Gems

  • 1. Spring Framework 5: Hidden Gems By Juergen Hoeller @springjuergen 1
  • 2. Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Framework 5.0 (Overview) Embracing JDK 9 as well as Kotlin and Project Reactor Driven by functional API design and reactive architectures Major baseline upgrade: Java SE 8+, Java EE 7+ • JDK 8, Servlet 3.1, Bean Validation 1.1, JPA 2.1, JMS 2.0 • support for JUnit 5 (next to JUnit 4.12) Comprehensive integration with Java EE 8 API level • Servlet 4.0, Bean Validation 2.0, JPA 2.2, JSON Binding API 1.0 • e.g. Tomcat 9.0, Hibernate Validator 6.0, Apache Johnzon 1.1 2
  • 3. Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Commons Logging Bridge “spring-jcl” as a custom Commons Logging bridge • separate module within the Spring Framework umbrella • the only required dependency of the spring-core module First-class support for Log4j 2, SLF4J, and JUL (java.util.logging) • Spring-style runtime detection of Log4J 2 and SLF4J providers • strong integration with java.util.logging (location-aware LogRecord etc) No custom bridges and no custom excludes in application POMs! • streamlined setup of Log4j or Logback without extra bridge artifacts • no exclude of standard “commons-logging” for “jcl-over-slf4j” anymore 3
  • 4. Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Build-Time Components Indexer Classpath scanning on startup may be slow • <context:component-scan> or @ComponentScan • file system traversal of all packages within the specified base packages The common solution: narrow your base packages • Spring only searches within the specified roots in the classpath • alternatively: fully enumerate your component classes (no scanning at all) New variant in 5.0: a build-time annotation processor • spring-context-indexer generates META-INF/spring.components per jar • automatically used at runtime for compatible component-scan declarations 4
  • 5. Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Nullability Comprehensive nullability declarations across the codebase • non-null method parameters, method return values, fields by default • individual @Nullable declarations for actually nullable return values etc The Java effect: nullability validation in IntelliJ IDEA and Eclipse • e.g. for “Constant conditions & exceptions” inspection in Intellij IDEA • allowing us to catch subtle bugs/gaps in the framework's own codebase • allowing applications to validate their own interaction with Spring APIs The Kotlin effect: straightforward assignments to non-null variables • Kotlin compiler only allows such assignments for APIs with clear nullability 5
  • 6. Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Data Class Binding Spring data binding can work with immutable classes now • traditional setter methods versus named constructor arguments Property names matched against constructor parameter names • explicit property names via @ConstructorProperties • or simply inferred from class bytecode (-parameters or -debug) Perfect match: Kotlin data classes and Lombok data classes • data class Person(val name: String, val age: Int) • @Data public class Person { private final String name; private final int age; } 6
  • 7. Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Programmatic Lookup via ObjectProvider @Autowired ObjectProvider<MyBean> myBeanProvider Original ObjectProvider methods (dating back to 4.3) • @Nullable T getIfAvailable() • @Nullable T getIfUnique() New overloaded variants with java.util.function callbacks • T getIfAvailable(Supplier<T> defaultSupplier) • void ifAvailable(Consumer<T> dependencyConsumer) • T getIfUnique(Supplier<T> defaultSupplier) • void ifUnique(Consumer<T> dependencyConsumer) 7
  • 8. Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Refined Resource Interaction Overhaul of Spring's Resource abstraction in core.io • Resource.isFile() • DefaultResourceLoader returns writable FileUrlResource for “file:” Exposing NIO.2 API at the application level • Resource.readableChannel() • WritableResource.writableChannel() Internally using NIO.2 file access wherever possible • FileSystemResource.getInput/OutputStream() • FileCopyUtils.copy(File, File) 8
  • 9. Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Asynchronous Execution ListenableFuture interface with direct CompletableFuture support • ListenableFuture.completable() returns CompletableFuture • e.g. for futures returned from AsyncListenableTaskExecutor TaskScheduler interface with alternative to Date and long arguments • scheduleAtFixedRate(Runnable, Instant, Duration) • scheduleWithFixedDelay(Runnable, Instant, Duration) ScheduledTaskHolder interface for monitoring the current tasks • ScheduledAnnotationBeanPostProcessor.getScheduledTasks() • ScheduledTaskRegistrar.getScheduledTasks() 9
  • 10. Learn More. Stay Connected. Coming up: Spring Framework 5.0.3 Stay tuned for Spring Framework 5.1 next year… 10 #springone@s1p