Cannot Resolve Symbol SpringBootApplication - IntelliJ DEA
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
One of the common issues faced by developers when working with Spring Boot applications in IntelliJ IDEA is the Cannot Resolve Symbol @SpringBootApplication
error. This error typically indicates that the IntelliJ IDE cannot find the Spring Boot starter libraries required in your project's classpath. This article will delve into the reasons why this issue occurs and provide solutions to fix it.
What Is @SpringBootApplication?
The @SpringBootApplication
annotation is a convenience annotation that is a combination of three other annotations:
@Configuration: Tags the class as a source of bean definitions for the application context.@EnableAutoConfiguration: Tells Spring Boot to start adding beans based on classpath settings, other beans, and various property settings.@ComponentScan: Tells Spring to scan the package to find other beans, controllers, and services.
Common Causes of the Error
1. Missing Dependencies
The most common reason for the "Cannot Resolve Symbol @SpringBootApplication" error is that the necessary Spring Boot dependencies are not present in your pom.xml
(for Maven users) or build.gradle
(for Gradle users).
- Maven: Ensure your
pom.xmlincludes the correct Spring Boot starter dependencies. - Gradle: Ensure you have included the Spring Boot starter in the
build.gradlefile. - Re-importing the Maven or Gradle project within IntelliJ.
- Invalidating cache and restarting the IDE.
- For Maven: Right-click on the
pom.xmlfile and select "Maven" -> "Reload Project". - For Gradle: Use the "Refresh" button in the Gradle tool window.
- Navigate to
File->Invalidate Caches / Restart...->Invalidate and Restart. - Right-click on the
srcfolder ->Mark Directory as->Sources Root. - Navigate to
File->Project Structure->Project. - Select the correct JDK version compatible with your Spring Boot version.
- Use the
Build->Rebuild Projectoption in IntelliJ IDEA.
- Keep Dependencies Updated: Always use the latest compatible versions of your dependencies to minimize compatibility issues.
- Check IntelliJ Updates: Sometimes the IDE itself may have bugs that get resolved in later versions, so keeping it up to date can be beneficial.
- Cross-Verify Build Files: Verify that the build files do not have syntax errors or logical issues that might prevent them from being interpreted correctly by the build tool.
Related reading
- Can't Autowire Repository annotated interface in Spring Boot
- Cant autowire WebTestClient - no auto configuration
- Can't avoid hibernate logging SQL to console with Spring Boot and Logback
- Can't compile project when I'm using Lombok under IntelliJ IDEA
- Cannot return null for non-nullable type 'Person' within parent 'Messages' /getMessages/sendBy in GraphQL SDL aws appsync
- Cannot run tensorflow on GPU
- Can't create handler inside thread that has not called Looper.prepare()
- Can't execute jar- file 'no main manifest attribute

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.