Spring Boot 3.0 Migration

Migration to Spring Boot 3.0 is completed for below services

  1. File Management Service

  2. File Storage Service

  3. Transaction Storage Service

  4. Account Processor Service

  5. Reference Data Service

  6. Rule Service

  7. Data Transformation Service

  8. Transaction Origination Service

  9. Validation Service

  10. Member Management Service

  11. Transaction Manager Service

  12. Trading Partner Service

This confluence page details the steps to be taken to migrate a Spring Boot 2.x project to Sprint Boot 3.0

Step 1: Follow the steps provided below to first migrate the project to Spring Boot 2.7.x if the current project is in a version prior to 2.7.x. Skip this step if the project is already a Spring Boot 2.7.x project

pom.xml updates

  • Update the Spring boot parent version to 2.7.5

  • Update Zeus Library version to 1.0.70

  • Remove the mysql dependency

<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency>
  • Add the below dependency for mysql

<dependency> <groupId>com.mysql</groupId> <artifactId>mysql-connector-j</artifactId> <scope>runtime</scope> </dependency>
  • Add the below dependency for flyway

<dependency> <groupId>org.flywaydb</groupId> <artifactId>flyway-mysql</artifactId> </dependency>
  • The spring doc dependency should be the one the one below

  • Comment the below dependencies if it is uncommented

  • Reload the maven project to get all the dependencies

  • Clean the project

  • Package the project to see if there are any errors

  • Start the service to ensure the project starts without any exceptions

  • Commit the code to github

Step 2: Follow the steps provided below to migrate the project from Spring Boot 2.7.x to Spring Boot 3.0.x

pom.xml updates

  • Update the Spring boot parent version to latest 3.0.x version

  • Update Zeus Library version to 1.0.80 (or the latest version)

  • Remove the below spring doc dependency

  • Add the below dependencies

  • Reload the maven project (this may take some time)

  • Clean the project

  • Package the project and you should see exceptions for not able to find javax.persistence.* package

  • Replace javax.persistence package with jakarta.persistence package on all the files.

  • If there is security implemented javax.servlet package with jakarta.servlet package on all the files.

  • You may also see an error for the below code

  • Replace it with the below code

  • Add the below property in application.xml

  • Security Implementation Updates

    • The respective SecurityConfig (Refer to ZeusSecurityConfig in api-gateway service) have to be updated as below

      • Remove the WebSecurityConfigurerAdapter implementation (This is removed in Spring Boot 3.0)

      • The configure method has to be updated with return type “SecurityFilterChain”, the name can also be updated as “filterChain”

      • authorizeRequests method has to be updated with authorizeHttpRequests

      • antMatchers method as to be replaced with requestMatchers

      • Add AuthenticationProvider instance and add it to the httpSecurity instance

      • return the httpSecurity

      • If BeanConfig class is not present create one and add the Authentication Provider Bean (Refer to BeanConfig in api-gateway service for a sample)

  • Clean the project

  • Package the project. If you have javax.validation.* package you will see exceptions for not able to find it.

  • Replace javax.persistence package with jakarta.validation package on all the files.

  • Clean the project

  • Package the project.

  • If the build was successful, run the service to check if it starts without any exceptions.

  • If application starts, commit the code to github.