org.springframework.boot.SpringApplication无法解析

mev*_*esh 5 java spring netbeans spring-boot spring-web

我正在尝试使用 spring-boot (1.2.4.RELEASE) 将 Web 服务服务器作为独立应用程序运行。我参考了这里提供的教程

但在我的应用程序中,我无法在 Spring Boot 的任何 API 中找到 org.springframework.boot.SpringApplication 类。

下面是我为此使用的 pom.xml 文件:

<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>
Run Code Online (Sandbox Code Playgroud)

谁能帮我找出这可能出了什么问题。

mev*_*esh 2

我得到了这个工作。使用mvn clean install后它就开始工作了。

最初,项目依赖项中没有显示 spring-boot-1.2.5.RELEASE.jar(SpringApplication 类所属的)。运行上述命令后,此依赖项已添加,现在工作正常。