JAVA
자바 스프링부트 2.7.7->3.3.9 업그레이드 (1)
생활개발
2025. 2. 27. 11:52
728x90
스프링부트 2.7.7버전을 사용하고 있었는데 이제 지원이 종료되기도 하였고,
Spring AI써보려고 하니까 3.2 or 3.3버전 써야된다고해서
이참에 자바도 버전 올리고 스프링부트도 버전 올려보자! 해서 마침 내가 시간이 남아서 해보려고 했음.
기존)
build.gradle
plugins {
id 'org.springframework.boot' version '2.7.7'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'war'
}
group = 'test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'mysql:mysql-connector-java'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
implementation 'org.springframework.boot:spring-boot-starter-security' //스프링시큐리티
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' //스프링시큐리티를 타임리프에서 사용하기위함
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.apache.poi:poi:3.17'
implementation 'org.apache.poi:poi-ooxml:3.17'
implementation 'org.json:json:20171018'
implementation "org.springframework.boot:spring-boot-starter-mail" //메일
}
tasks.named('test') {
useJUnitPlatform()
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
먼저 기본적으로
Spring Boot : 2.7.7
Java : 11
gradle : 7.4
이렇게 쓰고 있었음
처음엔 무작정
id 'org.springframework.boot' version '3.3.9'
이렇게 수정해서 gradle build 해봤는데 오류 투성이다!!!!
아무래도 2.7->3.3으로 버전을 한번에 많이 올려서 그런거같음.
한단계식 버전 업그레이드 하는게 좋다고 하는데
난 무대뽀로 그냥 진행!
수정후)
build.gradle
plugins {
id 'org.springframework.boot' version '3.3.9' //2.7.7 -> 3.3.9 수정
id 'io.spring.dependency-management' version '1.0.13.RELEASE' //1.0.11 -> 1.0.13 수정
id 'java'
id 'war'
}
group = 'test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17' //자바 17버전
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
// implementation 'org.springframework.boot:spring-boot-starter-tomcat' //spring-boot-starter-web에 포함
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
// runtimeOnly 'mysql:mysql-connector-java'
runtimeOnly 'com.mysql:mysql-connector-j' //스프링부트 3.X버전 넘어오면서 바뀜
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
implementation 'org.springframework.boot:spring-boot-starter-security' //스프링시큐리티
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6' //스프링시큐리티를 타임리프에서 사용하기위함 3.X버전부턴 6을 사용
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.apache.poi:poi:3.17'
implementation 'org.apache.poi:poi-ooxml:3.17'
implementation 'org.json:json:20171018'
implementation "org.springframework.boot:spring-boot-starter-mail" //메일
}
tasks.named('test') {
useJUnitPlatform()
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
자바, gradle, springsecurity, mysql-connect 이렇게 상당히 많은 문제가 있었다.
저렇게 수정하니까 build.gradle은 빌드 됬는데!!
스프링부트 3.0으로 넘어오면서 javax.servlet.* 도 jakarta.servlet.*로 바뀐다고 하고
스프링시큐리티도 6버전으로 올리면서 변화가 상당히 많아 보임!!
우선은 당장에 버전 올렸으니까 여기에 만족하고
버전 바뀌면서 수정해야된는건 따로 올리겟습니다!
728x90