I have a gradle build file as follows:
plugins {
id 'org.springframework.boot' version '2.7.5'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
}
group = 'com.example'
version = '1.0'
sourceCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
ext {
set('springBootAdminVersion', "2.7.4")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'de.codecentric:spring-boot-admin-starter-client'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
dependencyManagement {
imports {
mavenBom "de.codecentric:spring-boot-admin-dependencies:${springBootAdminVersion}"
}
}
tasks.named('test') {
useJUnitPlatform()
}
After refreshing my gradle project, I see mssql-jdbc-10.2.1.jre8.jar
in my classpath. My project is using Java 17 though.
Why doesn't Spring Boot import the Java 17 version, mssql-jdbc-10.2.1.jre17.jar
, since I'm using Java 17? Is there a problem using that jar?
Similarly, is there a problem with using the latest version of the driver, 11.2.1?
Perhaps, only mssql-jdbc-10.2.1.jre8.jar
is approved / fully tested to work with Spring Boot 2.7.5. If so, is it OK to use that jar when my project is using JRE 17?
CodePudding user response:
The minimum version of Java that Spring Boot 2.7 support is Java 8. For this reason the jre8
dependency is used by default. In Spring Boot 3.0, which will require Java 17, the jre17
dependency is used by default. If you're using Java 17 with Spring Boot 2.7, there's no problem with using the jre17
dependency.
Similarly, is there a problem with using the latest version of the driver, 11.2.1?
There shouldn't be a problem. Spring Boot 2.7 uses 10.2.x of the MSSQL driver because 10.2.x was the latest version that was available when Spring Boot 2.7 was released. Spring Boot's maintenance policy is such that a maintenance release of Spring Boot won't upgrade to a new minor or major version of a dependency. The soon-to-be-released Spring Boot 3.0 has upgraded to 11.2.x.