r/SpringBoot • u/nutsbrainup • Feb 12 '26
Question Spring boot upgrade from 2.7 to 3.5
I have this task of upgrading the Spring boot version from 2.7 to 3.5.7 and Java version from 1.8 to 17.
I've never really worked on such a thing and copilot is creating a mess out of it.
What's the best way to do it? Any suggestions would be helpful.
19
Upvotes
24
u/ChitranshAgarwal Feb 12 '26
Use OpenRewrite recipes to do that. It’s made just for these things. We did an upgrade to Java 25 and the experience have been seamless
5
u/AdmirableOffer2 Feb 12 '26 edited Feb 12 '26
Look mostly u need to change the imports from javax to Jakarta
3
u/Devang_4104 Feb 12 '26
I have successfully completed this activity before. The process depends completely on the dependencies you are using. To guide you, I need to know the dependencies you are using.
2
u/PerViceroy Feb 12 '26
Did the similar few month ago, my experience - there are plenty of changes from 1.8 to 17, but most of the stuff should work the same language related, like labmdas etc.. The pain is the dependencies - first upgrade to 3.0 and then jump straight to 3.5.x (i dont think it is easier to go 3.1, 3.2). If you are using hibernate, that will need changes. Spring modules like security are very different. Pom.xml stuff too. Go one by one, check latest, upgrade, run and repeat. That worked for me, because I didnt know openrewrite.
We did use at the start jhipster to generate the project with sboot 2.2.7, I was lost upgrading from 2.2.7 to 3.3.x. Since the project is similar, I generated general example jhipster project with newest version and checked configuration classes against themselves. Might help you.
1
u/AdmirableOffer2 Feb 12 '26
Some dependency might create issue
1
u/themasterengineeer Feb 12 '26
This video shows how to update from 3.5.x over to 4.x, you can follow the same approach for your task:
https://youtu.be/GK-iMDavA-E
1
u/mr_awake0172 Feb 12 '26
Furst upgrade the maven/gradle then update the java version and then springboot version Keep resolving dependencies
I am doing this same work for tons of repos from the last 3 months and will continue to do till may for Goldman Sachs.
1
u/Anbu_S Feb 12 '26
OpenRewrite is your friend.
1
u/A_random_zy Feb 12 '26
I'm doing the same thing. I'm using Openrewrite + cursor + manual stuff
1
u/tleipzig Feb 13 '26
Do it separately, that means Java update first (easy) and then Spring Boot. Would recommend to jump to Java 25 and Spring Boot 4, otherwise you're migrating onto soon outdated versions.
Depending on the app, it might be quicker creating the basic layout from scratch (see Bootify.io) and then put in your existing logic.
1
u/jonatan-ivanov Feb 17 '26
There is a 2.7 -> 3.0 migration guide: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide
Also, maybe you want your management and co-workers know that 4.0 is already released and 3.5 will not be supported after 2026 June (there is enterprise support though).
1
u/Escacibar Oct 09 '26
We recently migrated from Java 8 to 17 and Jboss 7 to 8
Once you get hang of it it will be easy
0
u/Theorem101 Feb 12 '26
There is special plugin on vs code for copilot that has under hood open rewrite and some of its own stuff https://learn.microsoft.com/en-us/azure/developer/github-copilot-app-modernization/quickstart-upgrade?source=recommendations