Migration to Spring Boot v3.0.0 How to
Pom.xml changes
Change spring-boot-starter-parent to 3.0.0
Change the version of the artifact to the next major version
Change java.version to 17
Version for all dependencies and plugins must be provided as properties
Use the latest version for all dependencies and plugins available in the Maven repository
Openapi-generator-maven-plugin should contain the following configuration
<generateSupportingFiles>true</generateSupportingFiles>
<supportingFilesToGenerate>ApiUtil.java</supportingFilesToGenerate>
<configOptions>
…
<useSpringBoot3>true</useSpringBoot3>
…
</configOptions>
All Java src
All javax.servlet.* imports must be replaced with jakarta.servlet.*
All javax.persistence.* imports must be replaced with jakarta.persistence.*
All javax.validation.* imports must be replaced with jakarta.validation.*
All javax.annotation.* imports must be replaced with jakarta.annotation.*
spring.factories in src/main/resources/META-INF; If the file exists, remove org.springframework.boot.autoconfigure.EnableAutoConfiguration from the file and copy all the configuration into org.springframework.boot.autoconfigure.AutoConfiguration.imports in src/main/resources/META-INF/spring see: https://github.com/folio-org/folio-spring-base/blob/feature/FOLSPRINGB-81/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
Jenkinsfile
Change: buildNode = 'jenkins-agent-java17'
healthChkCmd = 'wget --no-verbose --tries=1 --spider http://localhost:8081/admin/health || exit 1'
Dockerfile
Change: FROM folioci/alpine-jre-openjdk17:latest
Add (for details see README):
# Install latest patch versions of packages: https://pythonspeed.com/articles/security-updates-in-docker/ USER root RUN apk upgrade --no-cache USER folio
Application.yaml
Add: spring.cloud.openfeign.okhttp.enabled = true if a project uses FeignClient
Change: spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
If a module uses PostgreSQL ENUMs
pom.xml: add hypersistence-utils-hibernate-60 dependency see: https://github.com/folio-org/mod-password-validator/blob/feature/MODPWD-110/pom.xml#L88
In entity classes replace @Type annotation with @Enumerated(EnumType.STRING) @Type(PostgreSQLEnumType.class) see: https://github.com/folio-org/mod-password-validator/blob/feature/MODPWD-110/src/main/java/org/folio/pv/domain/entity/PasswordValidationRule.java#L32
If wiremock-jre8 is used
pom.xml: add property <jetty.version>9.4.49.v20220914</jetty.version> see: https://github.com/folio-org/mod-password-validator/blob/feature/MODPWD-110/pom.xml#L40
According to Spring Doc in Spring Boot 3.0.0 (from Spring Framework 5.8) WebSecurityConfigurerAdapter was deprecated and SecurityFilterChain was introduced.
So WebSecurityConfigureAdapter must be removed and authorizeRequests() deprecated method changed to authorizeHttpRequests()https://docs.spring.io/spring-security/reference/5.8/migration/servlet/config.html#_stop_using_websecurityconfigureradapter (SecurityFilerChain)
https://docs.spring.io/spring-security/reference/5.8/migration/servlet/config.html#use-new-requestmatchers (anyMatchers to requestMatchers)
https://spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter