'org.springframework.boot.SpringApplication can not be resolved
I am trying to Run a web-service server as standalone application using the spring-boot (1.2.4.RELEASE). I have refereed the tutorial provided here spring site.
But in my application I am unable to locate org.springframework.boot.SpringApplication class in any of the APIs of spring boot.
Below is pom.xml file I am using for this:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.4.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Can anyone help me to find out what could be wrong in this.
Solution 1:[1]
I got this working. After using the mvn clean install it has started working.
Initial it was not showing the spring-boot-1.2.5.RELEASE.jar(to which SpringApplication class belong) in the project dependencies. After running above command this dependency got added and now its working fine.
Solution 2:[2]
As a newbie to Spring framework, this was one of the errors due to using unmatching java versions in the spring initializer and own project.
I had generated the initializing files with Spring Initializer using JDK 8. But had JDK 11 for the rest of the project's configurations.
Solution - I simply created a new spring initialing file using the Spring documentation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mevada.yogesh |
| Solution 2 | Upulie Han |
