Upgrade Guide: Transitioning DIGIT Modules to Spring Boot Version 3.2.2
Overview
This document contains information about the code changes that will be required in the registries for upgrading Spring boot and client libraries
Steps
POM Updates
Upgrade the Java version in the module to Java 17 before upgrading the Spring Boot version to 3.2.2. Following is a sample snippet of the Java version upgrade:
Upgrade spring-boot-starter-parent library to version 3.2.2. The code snippet of the dependency is shown below:
Upgrade the Flyway library to version 9.22.3 for compatibility with Postgres 14. Below is the code snippet:
Upgrade the postgresql library to version 42.7.1:
The tracer library is upgraded to springboot 3.2.2. The updates are available in the library version 2.9.0-SNAPSHOT. If the module is using the tracer, upgrade the tracer version to 2.9.0-SNAPSHOT as shown below:
The service-common library is upgraded and added in tracer. You don't have to explicitly upgrade the services-common library and remove it from POM if you upgrade the tracer. In case your module is using only services-common, you can directly upgrade the version to 2.9.0-SNAPSHOT
Use the below version of JUnit which is compatible with Java 17:
If you are using the MDMS client library update the dependency version to 2.9.0-SNAPSHOT as shown below:
Update the Lombok version in the pom.xml to 1.8.22:
If you are using net.minidev library, upgrade the version to
2.5.0
To simplify dependency management and ensure version compatibility for Spring Kafka and Spring Redis dependencies use the spring-boot-starter-parent as your project's parent in the pom.xml. This ensures the spring-kafka or spring-redis dependency is included without specifying a version, Spring Boot will automatically provide a compatible version of the dependency. Following are code snippets of both the dependencies:
Note: If a tracer library is implemented there is no need to explicitly import spring-kafka.
Registry Code Changes
Javax is deprecated and transitioning to Jakarta. Remove any Javax dependencies and update all Javax imports to Jakarta. For example, change imports like PostConstruct and valid to their Jakarta counterparts in all occurrences.
Remove the annotation @javax.annotation.Generated which is now deprecated.
Update the Dockerfile for flyway migration with the below content:
FROM egovio/flyway:10.7.1
COPY ./migration/main /flyway/sql
COPY migrate.sh /usr/bin/migrate.sh
RUN chmod +x /usr/bin/migrate.sh
ENTRYPOINT ["/usr/bin/migrate.sh"]
Update the migrate.sh script:
#!/bin/sh
flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate
If you are using spring-redis, add the following configuration file:
Remove @SafeHtml annotation from the fields in POJO models as it is deprecated.
Update the Junit dependencies in the test cases as shown below:
![](https://core.digit.org/~gitbook/image?url=https%3A%2F%2F3868804918-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FegsIWleSdyH9rMLJ8ShI%252Fuploads%252FcVVvUb0F7s9wybIdFFOB%252FScreenshot%25202024-03-04%2520at%25207.03.06%2520PM.png%3Falt%3Dmedia%26token%3D99bb897b-f6a1-4aea-8362-7f24ed5516fe&width=768&dpr=4&quality=100&sign=7b137a0c&sv=1)
Last updated