Java spring import error
I downloaded spring-framework-4.1.6.RELEASE from http://maven.springframework.org/release/org/springframework/spring/
Then I went to the Spring Website http://spring.io/guides/gs/rest-service/ to start a project, but I found there was a problem in it.
//The import org.springframework.boot cannot be resolved
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
It can't seem to find the jar files, so it can't import it, but I add all the jar files to create the path.
How can I solve this? Are Spring and SpringFramework the same?
source to share
It looks like you are trying to access the classes that are part of the Spring Boot project, maybe your Spring libraries do not contain the libraries of the project related w760> projects.
Naturally, I would recommend that you import it via Maven or Gradle as suggested by Spring Boot Quickstart.
But if you want to add it manually, the latest jar currently for SpringApplication
would be spring-boot-1.2.3.RELEASE.jar
Find HERE
And the class SpringBootApplication
is in spring-boot-autoconfigure-1.2.3.RELEASE.jar
Find HERE
So, check if you have similar jars among your current ones and load them if not, also remember, since you are dealing with dependencies manually, it is quite possible that these two new libraries will have their own dependencies and you will have to adapt to him.
source to share
I got the problem that just anything in the org.springframework.boot.autoconfigure package. * failed to resolve / compile although proper jar was included in the classpath.
My solution: wipe the local maven repository
Running the command line "mvn clean compile" showed me a line like
[ERROR] error reading /Users/greyshine/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.4.3.RELEASE/spring-boot-autoconfigure-1.4.3.RELEASE.jar; invalid LOC header (bad signature)
This gave me the assumption that the artifact was not loaded correctly in the first run. I destroyed my maven spring boot repository artefacts (ie located at ~ / Users / MYHOME / .m2 / repository / org / springframework / boot), then I rebuild with mvn clean compile and it all worked.
source to share
I had a similar problem and fixed it by tweaking the pom.xml
from
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
in
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
source to share