I am very new to STS. I searched for this error in stackoverflow. I didn't find correct matching answer.
I am able to see the class in MavenDependencies seciton in STS but not able to add the annotation in my java class.
Your help will be appriciated. Thanks
Go to your maven repository directory
For windows on below path
C:\Users\YourUser\.m2\repository\org\springframework\boot
Then delete spring-boot-autoconfigure
folder.
Now go to eclipse Right click on project -> Maven -> Update Project
.
This solved the problem for me.
Run bellow commands from command line
mvn clean dependency:tree
mvn clean compile
select project and do a maven->update
This solved my problem
Neither of the above solutions worked for me as my code was this
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<properties>
<java.version>1.8</java.version>
</properties>
I was missing the <dependencies>
tag which lead to this error.
Add the import statement below your package declaration.
import org.springframework.boot.autoconfigure.SpringBootApplication;
You only need to add that annotation to your entry point, not every class. It goes on the same class that holds the main method to start Spring...
public static void main(String[] args) {
SpringApplication.run(CourseAPIApp.class, args);
}
Just change your spring boot version into 1.5.6 from 1.5.8.
trust me i have tried every other solution but only this solution worked for me.
Clear your org/springframework/boot folder under .m2/ file location and run mvn clean install command under project
import the following:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
I had the same problem. You can resolve it with building the project with the "eclipse:eclipse"
goal.