Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Migrating From Spring Boot 2 To Spring Boot 3 - What's Jakarta EE Got To Do with It?

Migrating From Spring Boot 2 To Spring Boot 3 - What's Jakarta EE Got To Do with It?

Jakarta EE 9 changed its package namespace from javax.* to jakarta.*. This may sound like a trivial change that mostly affects Jakarta EE. So, why should Spring developers care?

As it turns out, the namespace changes ripple throughout the entire Java ecosystem. And Spring is no exception. Spring Framework 6 and Spring Boot 3 raise their baseline to Jakarta EE 9 API level which is supported by Tomcat 10 and Jetty 11 for example.

Attending this session will teach you how to make this migration as smooth as possible. A live coding demo will take you through the steps involved, and point out where to pay special attention.

We will also briefly examine some of the changes introduced in Jakarta EE 10 that will prepare you for what to expect from Spring 6.x. Some pointers to what we can expect from Jakarta EE 11 will also be provided.

ivargrimstad

May 24, 2023
Tweet

More Decks by ivargrimstad

Other Decks in Programming

Transcript

  1. COPYRIGHT (C) 2022, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    COPYRIGHT (C) 2022, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Migrating From Spring Boot 2 To Spring Boot 3
    Ivar Grimstad

    Jakarta EE Developer Advocate
    Eclipse Foundation
    What's Jakarta EE Got To Do with It?

    View full-size slide

  2. @ivar_grimstad
    https://github.com/ivargrimstad
    https://www.linkedin.com/in/ivargrimstad
    @[email protected]
    ivargrimstad_of
    fi
    cial

    View full-size slide

  3. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)

    View full-size slide

  4. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Speci
    fi
    cation
    Document
    API
    TCK
    Final Speci
    fi
    cation
    Compatible
    Implementation(s)
    Speci
    fi

    View full-size slide

  5. Jakarta EE 10 Web Pro
    fi
    Jakarta EE 10 Platform
    Updated
    Not Updated
    New
    Authorization 2.1
    Activation 2.1
    Batch 2.1
    Connectors 2.1
    Mail 2.1
    Messaging 3.1
    Enterprise Beans 4.0
    RESTful Web Services 3.1
    JSON Processing 2.1
    JSON Binding 3.0
    Annotations 2.1
    CDI Lite 4.0
    Interceptors 2.1
    Dependency Injection 2.0
    Servlet 6.0
    Server Pages 3.1
    Expression Language 5.0
    Debugging Support 2.0
    Standard Tag Libraries 3.0
    Faces 4.0
    WebSocket 2.1
    Enterprise Beans Lite 4.0
    Persistence 3.1
    Transactions 2.0
    Managed Beans 2.0
    CDI 4.0
    Authentication 3.0
    Concurrency 3.0
    Security 3.0
    Bean Validation 3.0

    View full-size slide

  6. Jakarta EE 10 Core Pro
    fi
    Jakarta EE 10 Web Pro
    fi
    le
    Updated
    Not Updated
    New
    RESTful Web Services 3.1
    JSON Processing 2.1
    JSON Binding 3.0
    Annotations 2.1
    CDI Lite 4.0
    Interceptors 2.1
    Dependency Injection 2.0
    Servlet 6.0
    Server Pages 3.1
    Expression Language 5.0
    Debugging Support 2.0
    Standard Tag Libraries 3.0
    Faces 4.0
    WebSocket 2.1
    Enterprise Beans Lite 4.0
    Persistence 3.1
    Transactions 2.0
    Managed Beans 2.0
    CDI 4.0
    Authentication 3.0
    Concurrency 3.0
    Security 3.0
    Bean Validation 3.0

    View full-size slide

  7. Jakarta EE 10 Core Pro
    fi
    le
    Updated
    Not Updated
    New
    RESTful Web Services 3.1
    JSON Processing 2.1
    JSON Binding 3.0
    Annotations 2.1
    CDI Lite 4.0
    Interceptors 2.1
    Dependency Injection 2.0

    View full-size slide

  8. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Jakarta EE 10


    API source level: Java SE 11
    API binary level: Java SE 11
    TCK run with: Java SE 11+17
    App Developers (YOU) can use Java SE 17 features if you like!!

    View full-size slide

  9. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    How is this Relevant


    to
    ?

    View full-size slide

  10. javax.* -> jakarta.*

    View full-size slide

  11. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    builds on

    View full-size slide

  12. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    javax.* -> jakarta.*

    View full-size slide

  13. Authorization 2.1
    Activation 2.1
    Batch 2.1
    Connectors 2.1
    Mail 2.1
    Messaging 3.1
    Enterprise Beans 4.0
    RESTful Web Services 3.1
    JSON Processing 2.1
    JSON Binding 3.0
    Annotations 2.1
    CDI Lite 4.0
    Interceptors 2.1
    Dependency Injection 2.0
    Servlet 6.0
    Server Pages 3.1
    Expression Language 5.0
    Debugging Support 2.0
    Standard Tag Libraries 3.0
    Faces 4.0
    WebSocket 2.1
    Enterprise Beans Lite 4.0
    Persistence 3.1
    Transactions 2.0
    Managed Beans 2.0
    CDI 4.0
    Authentication 3.0
    Concurrency 3.0
    Security 3.0
    Bean Validation 3.0
    Jakarta EE 10 Web Pro
    fi
    le
    Updated
    Not Updated
    New

    View full-size slide

  14. Hibernate ORM

    View full-size slide

  15. UUID as Basic Java Type
    @Entity


    public class Item {




    @Id


    @GeneratedValue(strategy=GenerationType.UUID)


    private java.util.UUID id;


    private String description;





    }

    View full-size slide

  16. Authorization 2.1
    Activation 2.1
    Batch 2.1
    Connectors 2.1
    Mail 2.1
    Messaging 3.1
    Enterprise Beans 4.0
    RESTful Web Services 3.1
    JSON Processing 2.1
    JSON Binding 3.0
    Annotations 2.1
    CDI Lite 4.0
    Interceptors 2.1
    Dependency Injection 2.0
    Servlet 6.0
    Server Pages 3.1
    Expression Language 5.0
    Debugging Support 2.0
    Standard Tag Libraries 3.0
    Faces 4.0
    WebSocket 2.1
    Enterprise Beans Lite 4.0
    Persistence 3.1
    Transactions 2.0
    Managed Beans 2.0
    CDI 4.0
    Authentication 3.0
    Concurrency 3.0
    Security 3.0
    Bean Validation 3.0
    Jakarta EE 10 Platform
    Updated
    Not Updated
    New

    View full-size slide

  17. Hibernate Validator

    View full-size slide

  18. Authorization 2.1
    Activation 2.1
    Batch 2.1
    Connectors 2.1
    Mail 2.1
    Messaging 3.1
    Enterprise Beans 4.0
    RESTful Web Services 3.1
    JSON Processing 2.1
    JSON Binding 3.0
    Annotations 2.1
    CDI Lite 4.0
    Interceptors 2.1
    Dependency Injection 2.0
    Servlet 6.0
    Server Pages 3.1
    Expression Language 5.0
    Debugging Support 2.0
    Standard Tag Libraries 3.0
    Faces 4.0
    WebSocket 2.1
    Enterprise Beans Lite 4.0
    Persistence 3.1
    Transactions 2.0
    Managed Beans 2.0
    CDI 4.0
    Authentication 3.0
    Concurrency 3.0
    Security 3.0
    Bean Validation 3.0
    Jakarta EE 10 Platform
    Updated
    Not Updated
    New

    View full-size slide

  19. Eclipse Jetty Apache Tomcat

    View full-size slide

  20. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Demo

    View full-size slide

  21. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    New Spring App
    Scenario 1

    View full-size slide

  22. Spring Boot 3


    +


    Tomcat 9
    duke-spring
    Spring Boot 3


    +


    Tomcat 10
    duke-spring

    View full-size slide

  23. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Upgrade Spring App
    Scenario 2

    View full-size slide

  24. Spring Boot 2 Spring Boot 3
    duke-boot
    duke-boot

    View full-size slide

  25. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    javax.* -> jakarta.*

    View full-size slide

  26. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    IDE

    View full-size slide

  27. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    1. Update Spring version in pom.xml


    2. Update Jakarta EE version in pom.xml


    3. Fix the imports




    https://github.com/ivargrimstad/jakartaee-spring

    View full-size slide

  28. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Upgrade Spring App
    Scenario 3
    with Dependencies

    View full-size slide

  29. Spring Boot 2
    duke-boot
    duke-dep
    Spring Boot 3
    duke-boot
    duke-dep

    View full-size slide

  30. duke-dep
    Source

    View full-size slide

  31. Spring Boot 2
    duke-boot
    duke-dep
    Spring Boot 3
    duke-boot
    duke-dep
    2.0
    1.0

    View full-size slide

  32. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    1. Update Spring version in pom.xml


    2. Update Jakarta EE version in pom.xml


    3. Fix the imports


    4. Repeat for Dependencies



    https://github.com/ivargrimstad/jakartaee-spring

    View full-size slide

  33. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Upgrade Spring App
    Scenario 4
    with External Dependencies

    View full-size slide

  34. Spring Boot 2
    duke-boot
    duke-dep duke-lib
    Spring Boot 3
    duke-boot
    duke-dep duke-lib

    View full-size slide

  35. Source
    duke-dep
    Source
    duke-lib

    View full-size slide

  36. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Transformation

    View full-size slide

  37. Eclipse Transformer Apache Tomcat Migration Tool
    b.com/eclipse/transformerhttps://tomcat.apache.org/download-migration.cgi

    View full-size slide

  38. Spring Boot 2
    duke-boot
    duke-dep duke-lib
    Spring Boot 3
    duke-boot
    duke-dep duke-lib
    2.0
    1.0 2.0
    1.0

    View full-size slide

  39. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    1. Update Spring version in pom.xml


    2. Update Jakarta EE version in pom.xml


    3. Fix the imports


    4. Repeat for Dependencies


    5. Transform Libraries if necessary


    https://github.com/ivargrimstad/jakartaee-spring

    View full-size slide

  40. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Additional Migration
    Steps

    View full-size slide

  41. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    1. Update Spring version in pom.xml


    2. Update Jakarta EE version in pom.xml


    3. Fix the imports


    4. Repeat for Dependencies


    5. Transform Libraries if necessary


    6. Rename properties pre
    fi
    xed with javax


    7. Verify data and dynamic content
    https://github.com/ivargrimstad/jakartaee-spring

    View full-size slide

  42. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Beyond 10

    View full-size slide

  43. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Jakarta EE 11
    Coming Q1, 2024

    View full-size slide

  44. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Release Cadence

    View full-size slide

  45. COPYRIGHT (C) 2022, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Jakarta NoSQL
    Standardizes integration with NoSQL databases
    https://jakarta.ee/speci
    fi
    cations/nosql/
    NEW

    View full-size slide

  46. COPYRIGHT (C) 2022, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Jakarta Data
    Standardizes the repository pattern for data access
    https://jakarta.ee/speci
    fi
    cations/
    NEW

    View full-size slide

  47. COPYRIGHT (C) 2022, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Jakarta RPC
    Standardizes gRPC within Jakarta EE
    https://jakarta.ee/speci
    fi
    cations/rpc/
    NEW

    View full-size slide

  48. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Jakarta EE 11


    API source level: Java SE 17 or 21
    API binary level: Java SE 17 or 21
    TCK run with: Java SE 21
    Work in
    Progress

    View full-size slide

  49. COPYRIGHT (C) 2022, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    Summary

    View full-size slide

  50. Jakarta EE 10 Platform
    Updated
    Not Updated
    New
    Authorization 2.1
    Activation 2.1
    Batch 2.1
    Connectors 2.1
    Mail 2.1
    Messaging 3.1
    Enterprise Beans 4.0
    RESTful Web Services 3.1
    JSON Processing 2.1
    JSON Binding 3.0
    Annotations 2.1
    CDI Lite 4.0
    Interceptors 2.1
    Dependency Injection 2.0
    Servlet 6.0
    Server Pages 3.1
    Expression Language 5.0
    Debugging Support 2.0
    Standard Tag Libraries 3.0
    Faces 4.0
    WebSocket 2.1
    Enterprise Beans Lite 4.0
    Persistence 3.1
    Transactions 2.0
    Managed Beans 2.0
    CDI 4.0
    Authentication 3.0
    Concurrency 3.0
    Security 3.0
    Bean Validation 3.0

    View full-size slide

  51. Jakarta EE 10 Core Pro
    fi
    le
    Updated
    Not Updated
    New
    RESTful Web Services 3.1
    JSON Processing 2.1
    JSON Binding 3.0
    Annotations 2.1
    CDI Lite 4.0
    Interceptors 2.1
    Dependency Injection 2.0

    View full-size slide

  52. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    How is Relevant


    to

    View full-size slide

  53. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    relies on

    View full-size slide

  54. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    builds on

    View full-size slide

  55. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    depends on

    View full-size slide

  56. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    javax.* -> jakarta.*

    View full-size slide

  57. COPYRIGHT (C) 2023, ECLIPSE FOUNDATION, INC. | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0)
    1. Update Spring version in pom.xml


    2. Update Jakarta EE version in pom.xml


    3. Fix the imports


    4. Repeat for Dependencies


    5. Transform Libraries if necessary


    6. Rename properties pre
    fi
    xed with javax


    7. Verify data and dynamic content
    https://github.com/ivargrimstad/jakartaee-spring

    View full-size slide

  58. Jakarta EE
    https://jakarta.ee
    Jakartablogs

    https://jakartablogs.ee/
    Ivar’s Hashtag Jakarta EE
    https://www.agilejava.eu/category/jakarta-ee/
    Demo Code
    https://github.com/ivargrimstad/jakartaee-spring

    View full-size slide

  59. Jakarta EE Overview
    Course available on

    View full-size slide