@SpringBootApplication cannot be allowed for type B STS

I am very new to STS. I searched for this error in stackoverflow. I did not find the correct answer.

I can see the class in the MavenDependencies section in STS, but cannot add annotation in my Java class.

enter image description here Your help will be appreciated. thanks

enter image description here

+17
java spring spring-boot spring-tool-suite
source share
8 answers

Go to your maven repository directory. For windows on the path below C:\Users\YourUser\.m2\repository\org\springframework\boot Then delete the spring-boot-autoconfigure folder.

Now go to eclipse Right click on project -> Maven -> Update Project .

This solved the problem for me.

+50
source share

Run the commands below from the command line

 mvn clean dependency:tree mvn clean compile 

select the project and update maven-> This solved my problem

+2
source share

Just change your boot version of spring to 1.5.6 from 1.5.8. believe me, I tried all other solutions, but only this solution worked for me.

0
source share

Empty the org / springframework / boot folder in the .m2 / file folder and run the mvn clean install command in the project

0
source share

None of the solutions above helped me since my code was like that

 <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 missed the <dependencies> tag that led to this error.

0
source share

import the following:

 import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; 
0
source share

Add an import statement under the package declaration.

import org.springframework.boot.autoconfigure.SpringBootApplication;

You only need to add this annotation to the entry point, and not to each class. It extends to the same class that contains the main method for running Spring ...

  public static void main(String[] args) { SpringApplication.run(CourseAPIApp.class, args); } 
-one
source share

I had the same problem. You can solve this problem when creating a project with the goal of "eclipse:eclipse" .

-one
source share

All Articles