SlideShare a Scribd company logo
REACTIVE WEB
DEVELOPMENT WITH
SPRING BOOT 2
Mike Melusky - @mrjavascript
June 11, 2018 – Capital Area Software Engineers (CASE)
About Speaker
• Michael Melusky
• Software Developer and College Instructor
• Xbox One / PS4 gaming
• Meat smoking/grilling
About the session
• This is a talk on Java and Spring
• Ideally was hoping to delve more into JDK 10
• The main goal is to highlight the new “reactive web” features in Spring Framework
5 / Spring Boot 2
• Personally manage number of Spring applications:
• JDK 1.8.171
• Spring Boot 1.5.X
• Spring MVC
• Ultimately need to upgrade these to use Spring Boot 2
THIS IS A
JAVATALK
WHAT IS SPRING
FRAMEWORK?
What is Spring Framework?
• Spring Framework is a application framework for the Java platform
• It’s also an excellent IoC (Inversion of Controller) container too!
• https://start.spring.io
SPRING IS AWESOME FORYOUR
RESTFUL API
Spring Framework release history
• Spring Framework 3
• Released in 2010
• Spring Framework 4
• Released in 2014
• Spring Boot 1.0
• Released in 2014
• Spring Boot 1.5
• Released in 2017
• Spring Framework 5
• Released GA in 2017
• Spring Boot 2.0
• Released GA in 2018
Spring Framework v. Boot
• If we used the analogy of a recipe:
• Spring Framework contains the ingredients
• Spring Boot is the casserole
Spring Boot 2
• New features in Spring Boot 2:
• Only supports Java 8 and up
• Java 9 support is not on the 1.x branch!
• Improved development features (logging, monitoring, metrics)
• Everything is secured (including actuator endpoints and static resources)
• The main new feature the Reactive Support in Spring Boot 2
• WebFlux
• Reactive counterparts for MongoDB, Redis, Cassandra
WHAT ISTHE REACTIVE
WEB?
Reactive Programming
• Another paradigm, like object-oriented programming or functional programming,
or procedural programming
• For starters read the Reactive Manifesto:
• https://www.reactivemanifesto.org
REACTIVE MANIFESTO
Reactive Manifesto
• Responsive:
• System responds in timely matter
• Resilient:
• System stays responsive regardless of failure
• Elastic:
• System stays responsive under varying workload
• Message Driven:
• Relies on asynchronous message passing to establish a boundary between components
Takeaway points
• Reactive Programming is all about non-blocking applications that are
asynchronous and event-driven and require a small number of threads to scale
• TL;DR: asynchronous, message passing is heavily used
Blocking vs. Non-Blocking
MULTI-THREADED JAVA SERVER
BLOCKING
(TRADITIONAL SPRING
MVC APPLICATION)
Spring MVC
• Classical Model-View-Controller framework for building web applications
• Features:
• @Controller / @RestController
• @RequestMapping
• ModelAndView
• Creating a spring app using start.spring.io
• ** DEMO **
NON-BLOCKING
(SPRING REACTIVE
WEB)
Reactive StreamsAPI
• Spring Framework 5 embraces the Reactive Streams specification API:
• Adopted in java 9 via java.util.concurrent.Flow
• Reactive Streams is 4 interfaces:
• Publisher
• Subscriber
• Subscription
• - one to one lifecycle of a subscriber subscribing to a publisher
• Processor
• – represents a processing stage between publisher and subscriber
PUBLISHER
SUBSCRIBER
SUBSCRIPTION
PROCESSOR
Spring ReactiveWeb Framework
• Uses Reactor under the hood (implementation of Reactive Streams API)
• Reactor extends the implementation with the following:
• Mono:
• Implements Publisher and returns 0 or 1 elements
• Flux:
• Implements Publisher and returns N elements
SPRING
REACTIVE WEB
FRAMEWORK
Building a Spring ReactiveWebApp
• Two ways of handling routes:
• “Traditional”
• Uses @Controller/@RestController
• “Functional”
• Uses request handlers
• ** DEMO **
WHAT ELSE IS
MISSING?
RestTemplate
• RestTemplate can be used to make blocking HTTP requests in your Spring
Application
• With WebFlux, a non-blocking class named WebClient was introduced
RESTTEMPLATE
WEBCLIENT
WEBCLIENT
FINAL POINTS ON
SPRING REACTIVE WEB
Reactive Web Development with Spring Boot 2
Worth it going full reactive?
• Troubleshooting a Reactive application is a bit difficult, and there is the possibility
that, while fixing an issue, you might accidentally block code has been introduced.
• Most of the traditional Java-based integration libraries are still blocking.
• Limited options are available for Reactive data stores, except for a few NoSQL
databases such as MongoDB.
• Spring Security is still not supported.
PERFORMANCE BENEFITS
(BLOCKING EXAMPLE)
PERFORMANCE BENEFITS (NON-
BLOCKING)
Performance Benefits
• Source: https://dev.to/bufferings/springboot2-blocking-web-vs-reactive-web-46jn
REFERENCES
References
• Reactive Manifesto:
• https://www.reactivemanifesto.org
• SpringWeb Reactive Framework:
• https://docs.spring.io/spring-framework/docs/5.0.0.M1/spring-framework-
reference/html/web-reactive.html
• Spring Framework Guru: “Reactive Streams in Java”
• https://springframework.guru/reactive-streams-in-java/
Thank you for coming
• Code on MS GitHub, Slides on SlideShare:
• @mrjavascript

More Related Content

PPTX
Validating latest changes with XCI
PPTX
How to contribute to an open source project and don’t die during the Code Rev...
PPTX
ASP.NET Core Demos
PPTX
Web presentation
PPTX
ASP.NET Core Demos Part 2
PPTX
Apex world 2018 continuously delivering APEX
PPT
Building Reactive webapp with React/Flux
Validating latest changes with XCI
How to contribute to an open source project and don’t die during the Code Rev...
ASP.NET Core Demos
Web presentation
ASP.NET Core Demos Part 2
Apex world 2018 continuously delivering APEX
Building Reactive webapp with React/Flux

What's hot (20)

PPTX
Flux and React.js
PDF
Engage 2020: Hello are you listening, There is stream for everything
PDF
Developing Java Microservices Fast with Open Liberty
PPTX
ReactPHP + Symfony
PPTX
ONAP on Vagrant
PPTX
Migration from ASP.NET MVC to ASP.NET Core
PDF
Introduce flux & react in practice
PPTX
Mule soft meetup warsaw november 13th, 2019
PPTX
How to setup a development environment for ONAP
PDF
Moving ASP.NET MVC to ASP.NET Core
PPTX
Build PWA with Ionic Toolkit
PDF
Pune meetup 16 feb 2019
PPT
PPT
Brightcove presentation on Automated Testing
PPTX
How to Expand Anypoint Platform's Capabilities by Developing Custom Connectors
PPTX
When Camel Smiles
PDF
Continuous Delivery for Front-End Engineers
PPTX
ASP.NET Core Unit Testing
PPTX
React. Flux. Redux. by Andrey Kolodnitskiy
PPTX
How to Structure Your Xamarin Solution by Adhering to Common .NET Practices -...
Flux and React.js
Engage 2020: Hello are you listening, There is stream for everything
Developing Java Microservices Fast with Open Liberty
ReactPHP + Symfony
ONAP on Vagrant
Migration from ASP.NET MVC to ASP.NET Core
Introduce flux & react in practice
Mule soft meetup warsaw november 13th, 2019
How to setup a development environment for ONAP
Moving ASP.NET MVC to ASP.NET Core
Build PWA with Ionic Toolkit
Pune meetup 16 feb 2019
Brightcove presentation on Automated Testing
How to Expand Anypoint Platform's Capabilities by Developing Custom Connectors
When Camel Smiles
Continuous Delivery for Front-End Engineers
ASP.NET Core Unit Testing
React. Flux. Redux. by Andrey Kolodnitskiy
How to Structure Your Xamarin Solution by Adhering to Common .NET Practices -...
Ad

Similar to Reactive Web Development with Spring Boot 2 (20)

PPTX
An evening with React Native
PPTX
Introduction to react native with redux
PDF
Streaming to a New Jakarta EE
PDF
Streaming to a new Jakarta EE
PPTX
GDG Workshop on React (By Aakanksha Rai)
PDF
NCUG 2019: Super charge your API’s with Reactive streams
PDF
Streaming to a new Jakarta EE / JOTB19
PDF
Fluxible
PPTX
Introduction to React native
PPTX
Progressive Web Apps and React
PPTX
React js Online Training
PPSX
React-Js-Online-Training-9028522.ppsx
PPTX
react js training|react js training in mumbai|
PDF
Building front-end apps that Scale - FOSDEM 2014
PPT
Spring intro classes-in-mumbai
PDF
Meteor + React
PPTX
Introduction to Spring Framework
PPTX
Microfrontends Monoreops & Trunkbased based
PPT
Spring introduction
PPTX
Product Camp Silicon Valley 2018 - PM Technical Skills
An evening with React Native
Introduction to react native with redux
Streaming to a New Jakarta EE
Streaming to a new Jakarta EE
GDG Workshop on React (By Aakanksha Rai)
NCUG 2019: Super charge your API’s with Reactive streams
Streaming to a new Jakarta EE / JOTB19
Fluxible
Introduction to React native
Progressive Web Apps and React
React js Online Training
React-Js-Online-Training-9028522.ppsx
react js training|react js training in mumbai|
Building front-end apps that Scale - FOSDEM 2014
Spring intro classes-in-mumbai
Meteor + React
Introduction to Spring Framework
Microfrontends Monoreops & Trunkbased based
Spring introduction
Product Camp Silicon Valley 2018 - PM Technical Skills
Ad

More from Mike Melusky (19)

PPTX
Container Orchestration for .NET Developers
PPTX
Containerize all the things!
PPTX
Building a Google Cloud Firestore API with dotnet core
PPTX
Effective .NET Core Unit Testing with SQLite and Dapper
PPTX
Effective .NET Core Unit Testing with SQLite and Dapper
PPTX
Building xamarin.forms apps with prism and mvvm
PPTX
Xamarin.Forms Bootcamp
PPTX
Into to Docker (Central PA Java User Group - 8/14/2017)
PPTX
An afternoon with angular 2
PPTX
An evening with Angular 2
PPTX
Securing your azure web app with asp.net core data protection
PPTX
Ember.js and .NET Integration
PPTX
Building Native “apps” with Visual Studio 2015
PPTX
Emberjs and ASP.NET
PPTX
Fun with lambda expressions
PPTX
An evening with querydsl
PPTX
Fun with lambda expressions
PPTX
Fun with windows services
ODP
Philly.NET Code Camp 2014.1
Container Orchestration for .NET Developers
Containerize all the things!
Building a Google Cloud Firestore API with dotnet core
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
Building xamarin.forms apps with prism and mvvm
Xamarin.Forms Bootcamp
Into to Docker (Central PA Java User Group - 8/14/2017)
An afternoon with angular 2
An evening with Angular 2
Securing your azure web app with asp.net core data protection
Ember.js and .NET Integration
Building Native “apps” with Visual Studio 2015
Emberjs and ASP.NET
Fun with lambda expressions
An evening with querydsl
Fun with lambda expressions
Fun with windows services
Philly.NET Code Camp 2014.1

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Electronic commerce courselecture one. Pdf
PPTX
Cloud computing and distributed systems.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Teaching material agriculture food technology
Assigned Numbers - 2025 - Bluetooth® Document
The Rise and Fall of 3GPP – Time for a Sabbatical?
Per capita expenditure prediction using model stacking based on satellite ima...
20250228 LYD VKU AI Blended-Learning.pptx
A comparative analysis of optical character recognition models for extracting...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
“AI and Expert System Decision Support & Business Intelligence Systems”
Electronic commerce courselecture one. Pdf
Cloud computing and distributed systems.
Building Integrated photovoltaic BIPV_UPV.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Programs and apps: productivity, graphics, security and other tools
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
The AUB Centre for AI in Media Proposal.docx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Advanced methodologies resolving dimensionality complications for autism neur...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Reactive Web Development with Spring Boot 2

  • 1. REACTIVE WEB DEVELOPMENT WITH SPRING BOOT 2 Mike Melusky - @mrjavascript June 11, 2018 – Capital Area Software Engineers (CASE)
  • 2. About Speaker • Michael Melusky • Software Developer and College Instructor • Xbox One / PS4 gaming • Meat smoking/grilling
  • 3. About the session • This is a talk on Java and Spring • Ideally was hoping to delve more into JDK 10 • The main goal is to highlight the new “reactive web” features in Spring Framework 5 / Spring Boot 2 • Personally manage number of Spring applications: • JDK 1.8.171 • Spring Boot 1.5.X • Spring MVC • Ultimately need to upgrade these to use Spring Boot 2
  • 6. What is Spring Framework? • Spring Framework is a application framework for the Java platform • It’s also an excellent IoC (Inversion of Controller) container too! • https://start.spring.io
  • 7. SPRING IS AWESOME FORYOUR RESTFUL API
  • 8. Spring Framework release history • Spring Framework 3 • Released in 2010 • Spring Framework 4 • Released in 2014 • Spring Boot 1.0 • Released in 2014 • Spring Boot 1.5 • Released in 2017 • Spring Framework 5 • Released GA in 2017 • Spring Boot 2.0 • Released GA in 2018
  • 9. Spring Framework v. Boot • If we used the analogy of a recipe: • Spring Framework contains the ingredients • Spring Boot is the casserole
  • 10. Spring Boot 2 • New features in Spring Boot 2: • Only supports Java 8 and up • Java 9 support is not on the 1.x branch! • Improved development features (logging, monitoring, metrics) • Everything is secured (including actuator endpoints and static resources) • The main new feature the Reactive Support in Spring Boot 2 • WebFlux • Reactive counterparts for MongoDB, Redis, Cassandra
  • 12. Reactive Programming • Another paradigm, like object-oriented programming or functional programming, or procedural programming • For starters read the Reactive Manifesto: • https://www.reactivemanifesto.org
  • 14. Reactive Manifesto • Responsive: • System responds in timely matter • Resilient: • System stays responsive regardless of failure • Elastic: • System stays responsive under varying workload • Message Driven: • Relies on asynchronous message passing to establish a boundary between components
  • 15. Takeaway points • Reactive Programming is all about non-blocking applications that are asynchronous and event-driven and require a small number of threads to scale • TL;DR: asynchronous, message passing is heavily used
  • 19. Spring MVC • Classical Model-View-Controller framework for building web applications • Features: • @Controller / @RestController • @RequestMapping • ModelAndView • Creating a spring app using start.spring.io • ** DEMO **
  • 21. Reactive StreamsAPI • Spring Framework 5 embraces the Reactive Streams specification API: • Adopted in java 9 via java.util.concurrent.Flow • Reactive Streams is 4 interfaces: • Publisher • Subscriber • Subscription • - one to one lifecycle of a subscriber subscribing to a publisher • Processor • – represents a processing stage between publisher and subscriber
  • 26. Spring ReactiveWeb Framework • Uses Reactor under the hood (implementation of Reactive Streams API) • Reactor extends the implementation with the following: • Mono: • Implements Publisher and returns 0 or 1 elements • Flux: • Implements Publisher and returns N elements
  • 28. Building a Spring ReactiveWebApp • Two ways of handling routes: • “Traditional” • Uses @Controller/@RestController • “Functional” • Uses request handlers • ** DEMO **
  • 30. RestTemplate • RestTemplate can be used to make blocking HTTP requests in your Spring Application • With WebFlux, a non-blocking class named WebClient was introduced
  • 34. FINAL POINTS ON SPRING REACTIVE WEB
  • 36. Worth it going full reactive? • Troubleshooting a Reactive application is a bit difficult, and there is the possibility that, while fixing an issue, you might accidentally block code has been introduced. • Most of the traditional Java-based integration libraries are still blocking. • Limited options are available for Reactive data stores, except for a few NoSQL databases such as MongoDB. • Spring Security is still not supported.
  • 39. Performance Benefits • Source: https://dev.to/bufferings/springboot2-blocking-web-vs-reactive-web-46jn
  • 41. References • Reactive Manifesto: • https://www.reactivemanifesto.org • SpringWeb Reactive Framework: • https://docs.spring.io/spring-framework/docs/5.0.0.M1/spring-framework- reference/html/web-reactive.html • Spring Framework Guru: “Reactive Streams in Java” • https://springframework.guru/reactive-streams-in-java/
  • 42. Thank you for coming • Code on MS GitHub, Slides on SlideShare: • @mrjavascript