0

Migrating from Spring Boot 3.1.11 to 3.4.x causes test failures due to deprecated/removed classes – what’s the recommended approach? I’m upgrading a Spring Boot application from version 3.1.11 to 3.4.x. After upgrading, my build compiles successfully, but many JUnit tests fail due to deprecated or removed Spring classes/APIs. Examples of issues: Removed methods:

java.util.LinkedHashSet org.springframework.util.CollectionUtils.newLinkedHashSet(int)
Test context errors:
NoClassDefFoundError: Could not initialize class org.springframework.mock.web.MockServletContext
NoClassDefFoundError: org.springframework.test.context.TestContextManager

Find a safe and maintainable strategy to complete the Spring Boot upgrade without breaking existing test cases and ensure compatibility with newer Spring Framework APIs. What’s the recommended migration approach when upgrading to a newer Spring Boot minor version that removes/deprecates some utility methods and affects tests?

New contributor
Mahantesh is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
  • 1
    Do incremental upgrades, read the upgrade docs for each version. Also don't just upgrade Spring Boot you are probably using other libraries as well which require upgrading to be compatible. Next to that make sure you aren't outsmarting the dependency management done by spring by including dependencies yourself.
    – M. Deinum
    Commented Jul 31 at 8:54
  • The first step is to treat your pom/gradle file as completely broken, because they usually are. This reads like you have dependencies from different versions of Spring Boot in your project. But without an actual pom to look at, one can only guess.
    – Gimby
    Commented Jul 31 at 14:38

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.