SlideShare a Scribd company logo
1 of 55
SpringBoot to Quarkus
migration
Contents
1. who am i
2. what can you expect
3. what is quarkus
4. why migrate
5. migration
a. application description
b. steps
6. performance comparative
7. summary
8. references
$ whoami
JUG leader in the BarcelonaJUG
Organiser at JBCNConf ( Barcelona )
Software Engineer at Red Hat
App. Modernisation and Migration
team
Learning to play guitar
Learning Frozen songs to sing with my
daughter.
@vilojona
jvilalop@redhat.com
aytartana.wordpress.com
github.com/jonathanvila
What can you expect ?
My experience
v 2.1.5
v 1.2.0
opinionated option
magistral lecture
something that works
THE way
Quarkus brief description
What is Quarkus ?
A Kubernetes Native, Java, Scala, Kotlin stack
tailored for GraalVM and OpenJDK HotSpot
crafted from the best of breed Java libraries and standards.
300x faster 10x smaller focused on easy to code
opensource fast paced releases tons of extensions
Quarkus key facts
Quarkus extensions ( > 90 )
Kafka
Camel
Keycloak
Spring
Vert.x
RestEasy
….
Microprofile
Openshift
Jaegger
Flyway
Hibernate
Infinispan
...
Quarkus evolution
2018-12 v 0.0.1
2019-06 v 0.15.0
2019-11 v 1.0.0 Release
2020-01 v 1.2.0
1 minor version every 2 weeks !!! (+/-)
Quarkus performance
Quarkus OSS status
Migration of
Spring PetClinic REST
Why to migrate
My experience
with an easy CDI, REST, …
long startup times, eternal tests,
applications super big,
easy to develope applications
feeling of “lots of things happen under the
hood”
easy to develop applications,
fast
lightweight
not everything ready
Application migrated
Spring Data ( repositories, jdbc , ... )
Spring Web ( REST )
Spring Security
Spring documentation ( Swagger )
Spring actuators
Spring micrometer
Spring CDI
Spring AOP
Spring cache
Hibernate Panache
JaxRS
Quarkus Security
OpenAPI
SmallRye Health
Microprofile Metrics
CDI Spec ( Arc )
---
Quarkus cache ( Caffeine )
Elements not migrated
Spring JDBC querying
* no helper methods to work with Inserts, Updates….
* no equivalent to org.springframework.jdbc.core classes
* we need to reimplement everything using AGROAL
JMX
* not supported by GraalVM definition
CDI
● Replace Autowired by Inject
● Beans declaration using @ApplicationScoped
● Auto injection on Constructors
● Lazy by default
CDI
PROs
● straight forward migration for Beans
● no feature missing
CONs
● no annotation built-in beans
injection depending on Profile
● no private members on injection
JPA Repositories
● Repository classes to implement PanacheRepositoryBase<T, Integer>
Quarkus will generate the implementation of the usual methods :
list , find, persist, delete
JPA Repositories
PROs
● straightforward migration
CONs
● no Query DSL methods
Application
● Removed SpringApplication class
Quarkus doesn’t need a main entry application class
( needed to configure OpenApi )
Spring REST to JAX-RS
● Move from Spring REST to the standard JAX-RS
@RestController
@RequestMapping, @GetMapping,
@PostMapping, @PutMapping,
@DeleteMapping
@PathVariable
@Path
@GET,
@POST, @PUT
@DELETE
@PathParam
Spring REST to JAX-RS
PROs
● straightforward migration
INFO
● Spring also supports JAX-RS as 3rd party lib
Spring REST Security to Quarkus Security
● replaced Spring REST Security
Spring REST JDBC Security to Elytron JDBC realm
Add extension dependency : elytron-security-jdbc
Configure on properties file and remove configureGlobal method
Spring REST Security to Quarkus security
PROs
● Almost the same result
● By configuration rather than code
CONs
● Quarkus doesn’t have an expression language
CORS
● configured CORS in the application.properties file
CORS
PROs
● easy to enable , no code involved
CONs
● at global level, not per Controller
Metrics
● Add smallRye metrics extension
● Annotate each method ( for custom metrics )
Metrics
PROs
● OpenMetrics standard naming
CONs
● different naming than micrometer
( compatibility toggle being developed )
● not the same metrics
● no AOP so you need to annotate every
method
Validation
● Spring Validation to Hibernate Validator
● Move from @ControllerAdvice to JAX-RS ExceptionMapper
Swagger ( OpenAPI v 3.0 )
● Add extension “openapi”
● Add RestApplication
Validation
PROs
● standard
● easy
CONs
● Spring has more MVC features
Swagger ( OpenAPI v 3.0 )
PROs
● straightforward migration
● standard and easy way to configure
● Swagger-UI OOTB
CONs
● not REST paths scan configuration
AOP for app metrics
● use of microprofile metrics annotations
AOP for repository metrics
● using Hibernate built in metrics enabled in properties
AOP for app metrics
PROs
● standard
● easy to customise
CONs
● need to annotate ALL methods one by one for
custom app metrics
● no expression language to define methods affected
Local caching
● Spring uses a default ConcurrentHashMap
● Caffeine uses a ConcurrentLinkedHashMap
● Add “cache” extension ( Caffeine ) and annotate the method
Local Caching
PROs
● easy to implement and configure
● straightforward migration
CONs
● none
Test : REST
MockMVC -> RestAssured
Test REST
PROs
● RESTassured is easy to handle and very intuitive
CONs
● No way to simulate Roles without creating an user for each role to test
INFO
● Changed JSonPath to GPath
Test : Mocking
Create a Java class extending your real class and put it in Test folder
Tbh, I haven’t done it… I prefer to use Mockito
Test - resources
● Annotate test suites with @QuarkusTest to boot the app
● Annotate test suites with @QuarkusTestResource to load an embedded
resource
BUT……
Spring API compatible with Quarkus
Spring WEB ( REST) : spring-web extension
Using same Spring API for REST Supported Annotations
@RestController
@RequestMapping
@GetMapping
@PostMapping
@PutMapping
@DeleteMapping
@PatchMapping
@RequestParam
@RequestHeader
@MatrixVariable
@PathVariable
@CookieValue
@RequestBody
@ResponseStatus
@ExceptionHandler
Spring DI : spring-di extension
Using same API as Spring DI
Annotations Supported
@Autowired @Repository
@Qualifier @Scope
@Value @Component
* doesn’t support an expression language
@Configuration @Service
@Bean
Spring Data : spring-data-jpa
Using same API for Spring Data Supported
Any interface of : Repository,
CrudRepository, PagingAndSortingRepository,
JpaRepository
Derived Query Methods
User defined Queries
Not Supported
Invocations to any method of
QueryByExampleExecutor
QueryDSL
Spring Security: spring-security extension
Using same API as Spring Security
Annotations Supported
@Secured
@Preauthorized
Expressions allowed
hasAnyRole
permitAll
denyAll
isAnonymous
isAuthenticated
#paramName ==
Performance comparative ( not exhaustive )
SPRING QUARKUS
JVM
QUARKUS
GraalVM
build
( uber-jar )
4 s
43 Mb
13 s
43 Mb
133 s
85 Mb
boot 7.985 s
634.2 Mb
2.7 s
287.3 Mb
0.431 s
15.9 Mb
Summary
● Using specialised standard and open libraries
● Easy to code
● Full of documentation and examples
● Quarkus team/community is awesome
● Fast release cadence
● Few bugs on extensions ( but they fix them like Speedy Gonzalez )
● No-reflection goal can have some limitations ( AOP … )
● Not everything has a 1:1 migration ( Query DSL Methods , … )
References
Repositories
● Spring REST PetClinic
https://github.com/spring-petclinic/spring-petclinic-rest
● Quarkus REST PetClinic
https://github.com/jonathanvila/spring-petclinic-rest/tree/quarkus
Documentation/News/Help
● https://quarkus.io
● @QuarkusIO
● https://developers.redhat.com/search/?t=quarkus
● quarkus-dev@googlegroups.com
Interactive Tutorials ( Katacoda )
● https://developers.redhat.com/courses/quarkus/
List of Tutorials
● Getting Started
● For Spring Devs
● Streaming with
Kafka
● Hibernate and
Panache
● Prometeus &
Grafana
Cheat Sheet
● https://lordofthejars.github.io/quarkus-cheat-sheet/
by Alex Soto
Do you want to start coding with Quarkus ?
https://code.quarkus.io/
Windup
● Opensource tool to help on applications migrations
○ https://github.com/windup
○ to cloud readyness
○ to EAP...
○ soon to Quarkus
Thank you for having the patience to attend
and also to all who have
directly or indirectly helped me on this talk.
Special thanks to :
David Gómez, Alejandro Martinez, Abel Salgado
Alex Soto, Georgios Andrianakis
and the rest of Red Hat Quarkus team
@vilojona
jvilalop@redhat.com
aytartana.wordpress.com
github.com/jonathanvila

More Related Content

What's hot

Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJSHoang Long
 
Microservices Design Patterns Explained | Edureka
Microservices Design Patterns Explained | EdurekaMicroservices Design Patterns Explained | Edureka
Microservices Design Patterns Explained | EdurekaEdureka!
 
ASP.NETからASP.NET Coreに移行した話
ASP.NETからASP.NET Coreに移行した話ASP.NETからASP.NET Coreに移行した話
ASP.NETからASP.NET Coreに移行した話Taiga Takahari
 
Spring Boot Interview Questions | Edureka
Spring Boot Interview Questions | EdurekaSpring Boot Interview Questions | Edureka
Spring Boot Interview Questions | EdurekaEdureka!
 
Functional Application Logging : Code Examples Using Spring Boot and Logback
Functional Application Logging : Code Examples Using Spring Boot and LogbackFunctional Application Logging : Code Examples Using Spring Boot and Logback
Functional Application Logging : Code Examples Using Spring Boot and LogbackMohammad Sabir Khan
 
YOW2018 - Events and Commands: Developing Asynchronous Microservices
YOW2018 - Events and Commands: Developing Asynchronous MicroservicesYOW2018 - Events and Commands: Developing Asynchronous Microservices
YOW2018 - Events and Commands: Developing Asynchronous MicroservicesChris Richardson
 
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020Matt Raible
 
GIT presentation
GIT presentationGIT presentation
GIT presentationNaim Latifi
 
Introduction to Jira - Bug Tracking tool
Introduction to Jira - Bug Tracking toolIntroduction to Jira - Bug Tracking tool
Introduction to Jira - Bug Tracking toolGlobal SQA
 
Jmeter Performance Testing
Jmeter Performance TestingJmeter Performance Testing
Jmeter Performance TestingAtul Pant
 
Migrating to Microservices Patterns and Technologies (edition 2023)
 Migrating to Microservices Patterns and Technologies (edition 2023) Migrating to Microservices Patterns and Technologies (edition 2023)
Migrating to Microservices Patterns and Technologies (edition 2023)Ahmed Misbah
 
Introduction to jest
Introduction to jestIntroduction to jest
Introduction to jestpksjce
 

What's hot (20)

Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
Spring framework aop
Spring framework aopSpring framework aop
Spring framework aop
 
Microservices Design Patterns Explained | Edureka
Microservices Design Patterns Explained | EdurekaMicroservices Design Patterns Explained | Edureka
Microservices Design Patterns Explained | Edureka
 
Microservice intro
Microservice introMicroservice intro
Microservice intro
 
ASP.NETからASP.NET Coreに移行した話
ASP.NETからASP.NET Coreに移行した話ASP.NETからASP.NET Coreに移行した話
ASP.NETからASP.NET Coreに移行した話
 
Spring Boot Interview Questions | Edureka
Spring Boot Interview Questions | EdurekaSpring Boot Interview Questions | Edureka
Spring Boot Interview Questions | Edureka
 
Functional Application Logging : Code Examples Using Spring Boot and Logback
Functional Application Logging : Code Examples Using Spring Boot and LogbackFunctional Application Logging : Code Examples Using Spring Boot and Logback
Functional Application Logging : Code Examples Using Spring Boot and Logback
 
YOW2018 - Events and Commands: Developing Asynchronous Microservices
YOW2018 - Events and Commands: Developing Asynchronous MicroservicesYOW2018 - Events and Commands: Developing Asynchronous Microservices
YOW2018 - Events and Commands: Developing Asynchronous Microservices
 
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
A Tour of Combine
A Tour of CombineA Tour of Combine
A Tour of Combine
 
Tomcat server
 Tomcat server Tomcat server
Tomcat server
 
React Workshop
React WorkshopReact Workshop
React Workshop
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
 
Postman.ppt
Postman.pptPostman.ppt
Postman.ppt
 
Introduction to Jira - Bug Tracking tool
Introduction to Jira - Bug Tracking toolIntroduction to Jira - Bug Tracking tool
Introduction to Jira - Bug Tracking tool
 
Xke spring boot
Xke spring bootXke spring boot
Xke spring boot
 
Jmeter Performance Testing
Jmeter Performance TestingJmeter Performance Testing
Jmeter Performance Testing
 
Migrating to Microservices Patterns and Technologies (edition 2023)
 Migrating to Microservices Patterns and Technologies (edition 2023) Migrating to Microservices Patterns and Technologies (edition 2023)
Migrating to Microservices Patterns and Technologies (edition 2023)
 
Introduction to jest
Introduction to jestIntroduction to jest
Introduction to jest
 

Similar to Migration Spring Boot PetClinic REST to Quarkus 1.2.0

Migration Spring PetClinic to Quarkus
Migration Spring PetClinic to QuarkusMigration Spring PetClinic to Quarkus
Migration Spring PetClinic to QuarkusJonathan Vila
 
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech TalkSpring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech TalkRed Hat Developers
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfLuca Mattia Ferrari
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And BeyondVMware Tanzu
 
Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17Vinay Kumar
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEQAware GmbH
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEMario-Leander Reimer
 
Java dev mar_2021_keynote
Java dev mar_2021_keynoteJava dev mar_2021_keynote
Java dev mar_2021_keynoteSuyash Joshi
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]Leonardo Zanivan
 
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.Otávio Santana
 
Context-aware Fast Food Recommendation with Ray on Apache Spark at Burger King
Context-aware Fast Food Recommendation with Ray on Apache Spark at Burger KingContext-aware Fast Food Recommendation with Ray on Apache Spark at Burger King
Context-aware Fast Food Recommendation with Ray on Apache Spark at Burger KingDatabricks
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»DataArt
 
Java @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SPJava @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SPIlan Salviano
 
How does that PySpark thing work? And why Arrow makes it faster?
How does that PySpark thing work? And why Arrow makes it faster?How does that PySpark thing work? And why Arrow makes it faster?
How does that PySpark thing work? And why Arrow makes it faster?Rubén Berenguel
 
Efficient mobile automation
Efficient mobile automationEfficient mobile automation
Efficient mobile automationVitaly Tatarinov
 
JChem Microservices
JChem MicroservicesJChem Microservices
JChem MicroservicesChemAxon
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroOndrej Mihályi
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroPayara
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroPayara
 

Similar to Migration Spring Boot PetClinic REST to Quarkus 1.2.0 (20)

Migration Spring PetClinic to Quarkus
Migration Spring PetClinic to QuarkusMigration Spring PetClinic to Quarkus
Migration Spring PetClinic to Quarkus
 
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech TalkSpring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdf
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EE
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EE
 
Java dev mar_2021_keynote
Java dev mar_2021_keynoteJava dev mar_2021_keynote
Java dev mar_2021_keynote
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
 
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
 
Context-aware Fast Food Recommendation with Ray on Apache Spark at Burger King
Context-aware Fast Food Recommendation with Ray on Apache Spark at Burger KingContext-aware Fast Food Recommendation with Ray on Apache Spark at Burger King
Context-aware Fast Food Recommendation with Ray on Apache Spark at Burger King
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
 
Java @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SPJava @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SP
 
Exploring Quarkus on JDK 17
Exploring Quarkus on JDK 17Exploring Quarkus on JDK 17
Exploring Quarkus on JDK 17
 
How does that PySpark thing work? And why Arrow makes it faster?
How does that PySpark thing work? And why Arrow makes it faster?How does that PySpark thing work? And why Arrow makes it faster?
How does that PySpark thing work? And why Arrow makes it faster?
 
Efficient mobile automation
Efficient mobile automationEfficient mobile automation
Efficient mobile automation
 
JChem Microservices
JChem MicroservicesJChem Microservices
JChem Microservices
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 

Recently uploaded

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 

Recently uploaded (20)

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 

Migration Spring Boot PetClinic REST to Quarkus 1.2.0

  • 2. Contents 1. who am i 2. what can you expect 3. what is quarkus 4. why migrate 5. migration a. application description b. steps 6. performance comparative 7. summary 8. references
  • 3. $ whoami JUG leader in the BarcelonaJUG Organiser at JBCNConf ( Barcelona ) Software Engineer at Red Hat App. Modernisation and Migration team Learning to play guitar Learning Frozen songs to sing with my daughter. @vilojona jvilalop@redhat.com aytartana.wordpress.com github.com/jonathanvila
  • 4. What can you expect ? My experience v 2.1.5 v 1.2.0 opinionated option magistral lecture something that works THE way
  • 6. What is Quarkus ? A Kubernetes Native, Java, Scala, Kotlin stack tailored for GraalVM and OpenJDK HotSpot crafted from the best of breed Java libraries and standards.
  • 7. 300x faster 10x smaller focused on easy to code opensource fast paced releases tons of extensions Quarkus key facts
  • 8. Quarkus extensions ( > 90 ) Kafka Camel Keycloak Spring Vert.x RestEasy …. Microprofile Openshift Jaegger Flyway Hibernate Infinispan ...
  • 9. Quarkus evolution 2018-12 v 0.0.1 2019-06 v 0.15.0 2019-11 v 1.0.0 Release 2020-01 v 1.2.0 1 minor version every 2 weeks !!! (+/-)
  • 13. Why to migrate My experience with an easy CDI, REST, … long startup times, eternal tests, applications super big, easy to develope applications feeling of “lots of things happen under the hood” easy to develop applications, fast lightweight not everything ready
  • 14. Application migrated Spring Data ( repositories, jdbc , ... ) Spring Web ( REST ) Spring Security Spring documentation ( Swagger ) Spring actuators Spring micrometer Spring CDI Spring AOP Spring cache Hibernate Panache JaxRS Quarkus Security OpenAPI SmallRye Health Microprofile Metrics CDI Spec ( Arc ) --- Quarkus cache ( Caffeine )
  • 15. Elements not migrated Spring JDBC querying * no helper methods to work with Inserts, Updates…. * no equivalent to org.springframework.jdbc.core classes * we need to reimplement everything using AGROAL JMX * not supported by GraalVM definition
  • 16. CDI ● Replace Autowired by Inject ● Beans declaration using @ApplicationScoped ● Auto injection on Constructors ● Lazy by default
  • 17. CDI PROs ● straight forward migration for Beans ● no feature missing CONs ● no annotation built-in beans injection depending on Profile ● no private members on injection
  • 18. JPA Repositories ● Repository classes to implement PanacheRepositoryBase<T, Integer> Quarkus will generate the implementation of the usual methods : list , find, persist, delete
  • 19. JPA Repositories PROs ● straightforward migration CONs ● no Query DSL methods
  • 20. Application ● Removed SpringApplication class Quarkus doesn’t need a main entry application class ( needed to configure OpenApi )
  • 21. Spring REST to JAX-RS ● Move from Spring REST to the standard JAX-RS @RestController @RequestMapping, @GetMapping, @PostMapping, @PutMapping, @DeleteMapping @PathVariable @Path @GET, @POST, @PUT @DELETE @PathParam
  • 22. Spring REST to JAX-RS PROs ● straightforward migration INFO ● Spring also supports JAX-RS as 3rd party lib
  • 23. Spring REST Security to Quarkus Security ● replaced Spring REST Security
  • 24. Spring REST JDBC Security to Elytron JDBC realm Add extension dependency : elytron-security-jdbc Configure on properties file and remove configureGlobal method
  • 25. Spring REST Security to Quarkus security PROs ● Almost the same result ● By configuration rather than code CONs ● Quarkus doesn’t have an expression language
  • 26. CORS ● configured CORS in the application.properties file
  • 27. CORS PROs ● easy to enable , no code involved CONs ● at global level, not per Controller
  • 28. Metrics ● Add smallRye metrics extension ● Annotate each method ( for custom metrics )
  • 29. Metrics PROs ● OpenMetrics standard naming CONs ● different naming than micrometer ( compatibility toggle being developed ) ● not the same metrics ● no AOP so you need to annotate every method
  • 30. Validation ● Spring Validation to Hibernate Validator ● Move from @ControllerAdvice to JAX-RS ExceptionMapper
  • 31. Swagger ( OpenAPI v 3.0 ) ● Add extension “openapi” ● Add RestApplication
  • 32. Validation PROs ● standard ● easy CONs ● Spring has more MVC features
  • 33. Swagger ( OpenAPI v 3.0 ) PROs ● straightforward migration ● standard and easy way to configure ● Swagger-UI OOTB CONs ● not REST paths scan configuration
  • 34. AOP for app metrics ● use of microprofile metrics annotations
  • 35. AOP for repository metrics ● using Hibernate built in metrics enabled in properties
  • 36. AOP for app metrics PROs ● standard ● easy to customise CONs ● need to annotate ALL methods one by one for custom app metrics ● no expression language to define methods affected
  • 37. Local caching ● Spring uses a default ConcurrentHashMap ● Caffeine uses a ConcurrentLinkedHashMap ● Add “cache” extension ( Caffeine ) and annotate the method
  • 38. Local Caching PROs ● easy to implement and configure ● straightforward migration CONs ● none
  • 39. Test : REST MockMVC -> RestAssured
  • 40. Test REST PROs ● RESTassured is easy to handle and very intuitive CONs ● No way to simulate Roles without creating an user for each role to test INFO ● Changed JSonPath to GPath
  • 41. Test : Mocking Create a Java class extending your real class and put it in Test folder Tbh, I haven’t done it… I prefer to use Mockito
  • 42. Test - resources ● Annotate test suites with @QuarkusTest to boot the app ● Annotate test suites with @QuarkusTestResource to load an embedded resource
  • 44. Spring WEB ( REST) : spring-web extension Using same Spring API for REST Supported Annotations @RestController @RequestMapping @GetMapping @PostMapping @PutMapping @DeleteMapping @PatchMapping @RequestParam @RequestHeader @MatrixVariable @PathVariable @CookieValue @RequestBody @ResponseStatus @ExceptionHandler
  • 45. Spring DI : spring-di extension Using same API as Spring DI Annotations Supported @Autowired @Repository @Qualifier @Scope @Value @Component * doesn’t support an expression language @Configuration @Service @Bean
  • 46. Spring Data : spring-data-jpa Using same API for Spring Data Supported Any interface of : Repository, CrudRepository, PagingAndSortingRepository, JpaRepository Derived Query Methods User defined Queries Not Supported Invocations to any method of QueryByExampleExecutor QueryDSL
  • 47. Spring Security: spring-security extension Using same API as Spring Security Annotations Supported @Secured @Preauthorized Expressions allowed hasAnyRole permitAll denyAll isAnonymous isAuthenticated #paramName ==
  • 48. Performance comparative ( not exhaustive ) SPRING QUARKUS JVM QUARKUS GraalVM build ( uber-jar ) 4 s 43 Mb 13 s 43 Mb 133 s 85 Mb boot 7.985 s 634.2 Mb 2.7 s 287.3 Mb 0.431 s 15.9 Mb
  • 49. Summary ● Using specialised standard and open libraries ● Easy to code ● Full of documentation and examples ● Quarkus team/community is awesome ● Fast release cadence ● Few bugs on extensions ( but they fix them like Speedy Gonzalez ) ● No-reflection goal can have some limitations ( AOP … ) ● Not everything has a 1:1 migration ( Query DSL Methods , … )
  • 50. References Repositories ● Spring REST PetClinic https://github.com/spring-petclinic/spring-petclinic-rest ● Quarkus REST PetClinic https://github.com/jonathanvila/spring-petclinic-rest/tree/quarkus Documentation/News/Help ● https://quarkus.io ● @QuarkusIO ● https://developers.redhat.com/search/?t=quarkus ● quarkus-dev@googlegroups.com
  • 51. Interactive Tutorials ( Katacoda ) ● https://developers.redhat.com/courses/quarkus/ List of Tutorials ● Getting Started ● For Spring Devs ● Streaming with Kafka ● Hibernate and Panache ● Prometeus & Grafana
  • 53. Do you want to start coding with Quarkus ? https://code.quarkus.io/
  • 54. Windup ● Opensource tool to help on applications migrations ○ https://github.com/windup ○ to cloud readyness ○ to EAP... ○ soon to Quarkus
  • 55. Thank you for having the patience to attend and also to all who have directly or indirectly helped me on this talk. Special thanks to : David Gómez, Alejandro Martinez, Abel Salgado Alex Soto, Georgios Andrianakis and the rest of Red Hat Quarkus team @vilojona jvilalop@redhat.com aytartana.wordpress.com github.com/jonathanvila