SpringApplicationConfiguration not found Erroneous spring-boot-starter-test content?
Data Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.
Spring Boot is a powerful framework that simplifies the process of developing stand-alone, production-grade Spring applications. However, developers sometimes encounter issues with older elements of the Spring ecosystem, such as SpringApplicationConfiguration
. An error message such as "SpringApplicationConfiguration not found" typically occurs when there's an issue originating from deprecated or erroneous content in the spring-boot-starter-test
. This article dives into the potential causes and solutions related to this problem.
Understanding the Error
The SpringApplicationConfiguration
was an annotation used in earlier versions of Spring Boot to load a Spring application context for integration tests. With the introduction of Spring Boot 1.4, it was replaced by @SpringBootTest
. If you encounter a "not found" error, it is likely because the code is trying to use this deprecated annotation with a newer version of Spring Boot that no longer supports it.
Deprecated Elements
Here’s what typically leads to the SpringApplicationConfiguration
not found error:
- Using newer Spring Boot versions: If you are using Spring Boot 1.4 or later, ensure that all obsolete annotations like
SpringApplicationConfigurationare removed. - Inconsistent versions: Check the dependencies in your
pom.xmlor Gradlebuild.gradlefile to ensure that the versions of Spring Boot and Spring Framework are compatible. - Outdated documentation or tutorials: Follow newer documentation when learning or setting up a project to avoid implementing outdated patterns.
Solutions
Updating to @SpringBootTest
The modern way to write integration tests in a Spring Boot application is by using the @SpringBootTest
annotation.
Here's an example of how to modify a test class to replace SpringApplicationConfiguration
with @SpringBootTest
:
- Spring Boot's BOM (Bill of Materials): Utilize BOM to manage compatibility between dependencies.
- Regular Library Updates: Regularly update your libraries to ride on performance enhancements and bug fixes.
- Unit and Integration Tests: Separate unit tests and integration tests configure them properly using profiles or separate test execution phases.
Related reading
- SpringApplication.run main method
- SpringBoot - BeanDefinitionOverrideException Invalid bean definition
- SpringBoot - making jar files - No auto configuration classes found in META-INF/spring.factories
- Springboot - multiple property files per profile
- SpringBootTest No qualifying bean of type 'org.springframework.test.web.servlet.MockMvc' available
- SpringBootTest vs ContextConfiguration vs Import in Spring Boot Unit Test
- SpringBoot application stuck at springboot logo
- SpringBoot Async requests throwing 503 Service Unavailable

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.