Lab: Update the Spring Spring Boot dependencies ‐ 2: Update Spring Spring Boot dependencies - shinyay/spring-boot-2-7-to-3-1-upgrade GitHub Wiki
2: Update Spring/Spring Boot dependencies In the previous lab we updated the spring-boot-starter-parent to 3.1.3, and our code is compiling.
But, we need to do some housekeeping to ensure our code and builds aren't stale or fragile. Nobody wants tech debt...right?
So, as a best practice, we'll mitigate any hard-coded Spring dependency versions in our application.
We'll keep using the iterative SCAR method as we progressively upgrade our application.
Make a Small Change Locate hard-coded Spring dependency versions.
Open pom.xml and search through the Spring dependencies within.
Can you find any hard-coded versions?
spring-data-jdbc Look at spring-data-jdbc -- its version is hard-coded!
org.springframework.data spring-data-jdbc 2.4.14 Search the dependency tree.You can also see this version from the Maven Dependency Tree.
In the Terminal, generate the dependency tree with the following command, using the grep command to filter for our hard-coded dependency of spring-data-jdbc:
[~/exercises] $ ./mvnw dependency:tree | grep spring-data-jdbc You'll see output that looks like this:
[INFO] +- org.springframework.data:spring-data-jdbc:jar:2.4.14:compile This version is far too old for the version of Spring Boot we're targeting, which is 3.x.
Let's try to fix it!
Comment out the tag.
Got back to the pom.xml and comment-out the hard-coded spring-data-jdbc version.
spring-data-jdbc org.springframework.data spring-data-jdbc Ok, time to compile and assess.