Migration

Migration

Spring Boot 3 Migration- Migrate Spring Boot 2 To Spring Boot 3

·   STEPS  :

  1. Change the spring boot version:In build.gradal.kt

id("org.springframework.boot")version "2.7.18"  >>  id("org.springframework.boot") version "3.1.5"

id("io.spring.dependency-management") version "1.0.15.RELEASE" >> id("io.spring.dependency-management") version "1.1.3"

  1. Add single swagger dependency

implementation ("org.springdoc:springdoc-openapi-starter-webflux-ui:2.2.0")

·       Remove swagger dependency

    implementation ("org.springdoc:springdoc-openapi-ui:1.6.15")

    implementation ("org.springdoc:springdoc-openapi-kotlin:1.6.15")

    implementation ("org.springdoc:springdoc-openapi-webmvc-core:1.6.15")

    implementation ("org.springdoc:springdoc-openapi-webflux-ui:1.6.15")

    implementation ("org.springdoc:springdoc-openapi-hateoas:1.6.15")

    implementation ("org.springdoc:springdoc-openapi-data-rest:1.6.15")

    implementation ("org.springdoc:springdoc-openapi-security:1.6.15")

    implementation ("org.springdoc:springdoc-openapi-native:1.6.15")

    implementation ("org.springdoc:springdoc-openapi-javadoc:1.6.15")

    implementation("org.jlleitschuh.gradle:ktlint-gradle")

  1. Add Migration dependency

implementation ("org.springframework.boot:spring-boot-properties-migrator")

Note: Once you have completed your migration, please remove this dependency from the ‘pom.xml’.

  1. Add library

implementation ("commons-io:commons-io:2.11.0") >> implementation("commons-io:commons-io:2.13.0")

implementation ("com.google.code.gson:gson:2.10.1")

implementation ("io.jsonwebtoken:jjwt:0.12.3")

implementation ("org.apache.commons:commons-text:1.11.0")

implementation ("com.squareup.okhttp3:okhttp:4.12.0")

implementation ("com.github.lookfirst:sardine:5.12")

{exclude(group = "org.slf4j", module = "slf4j-simple")}

· Change library version

implementation("com.google.code.gson:gson:2.10") >>    implementation("com.google.code.gson:gson:2.10.1")

implementation("io.jsonwebtoken:jjwt:0.9.1") >> implementation("io.jsonwebtoken:jjwt:0.12.3")

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
jvmTarget = "17">>jvmTarget = "17"
}
}

  1. Update packages starting from ‘javax’ to ‘jakarta’ in HealthTrackerServerApplication.kt
  1. Change in SecurityConfig.kt
  1. Change in RedisConfig.kt
  1. Change in notificationConfig.kt
  1. Change in jwtUtils.kt
  1. Change in CustomSecurityContextRepository.kt
  1. Change in  JwtTokenProvider.kt
  1. Change in jwtAuthenticationFilter.kt
  1. Change in User.kt
  1. Change in UserPrincipal.kt
  1. Change in UserPrincipleReactiveService.kt

Read more