项目场景:Exception in thread “Thread-0” java.lang.NoSuchFieldError: Class org.springframework.boot.system.JavaVersion does not have member field ‘org.springframework.boot.system.JavaVersion NINE’
问题描述
项目启动成功了,下面出现报错,但是不影响我们的正常运行
每次运行,最后都会出现下面的错误

dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-devtools:2.7.9'
implementation 'org.projectlombok:lombok:1.18.28'
}
}
原因分析:
这就有可能是我们的依赖版本出现了问题
解决方案:
这里我们只需要把spring-boot-devtools后面的版本号去掉就可以了
修改后:
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-devtools:2.7.9'
implementation 'org.projectlombok:lombok:1.18.28'
}
提示:我这里用的是gradle,使用maven的可以使用类似的方法解决
664





