Java Spring import error


I've downloaded spring-framework-4.1.6.RELEASE from

Then I followed the Spring Website to start a project,but I found there is a problem in it.

//The import org.springframework.boot cannot be resolved
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

It seems like that it can't find the jar files so can't import it,but I've add all jar files to build path.
How can I solve it? Is Spring and SpringFramework the same one?

Best Solution

It looks like you are trying to access classes which are part of the Spring Boot project, it might be the case that your Spring libraries do not contain the Spring Boot project related libraries.

Naturally I'd recommend for you to import it via Maven or Gradle as suggested by the Spring Boot Quickstart.

But if you want to add it manually, the latest release jar currently for SpringApplication is spring-boot-1.2.3.RELEASE.jar

Find it HERE

And the SpringBootApplication class is found within spring-boot-autoconfigure-1.2.3.RELEASE.jar

Find it HERE

So check if you have similar jars among your current ones and download them if not, also remember since you are dealing with dependencies manually, it's quite possible that these two new libraries will have dependencies of their own and you'll have to accommodate to them as well.