SpringApplication.run(HelloWorldExampleApplication.class,args);

时间:2018-03-19 17:05:48

标签: java eclipse spring-boot eclipse-plugin

错误在以下代码行中 -

SpringApplication.run(HelloWorldExampleApplication.class, args);

它说 -

Multiple markers at this line
    - The type org.springframework.context.ConfigurableApplicationContext cannot be resolved. It is indirectly referenced 
     from required .class files
    - The method run(Class<?>, String...) from the type SpringApplication refers to the missing type 
     ConfigurableApplicationContext

我试过运行命令"mvn dependency:purge-local-repository",并说mvn没有被识别为int / ext命令。

我在eclipse IDE中使用springboot sts插件。 请。帮助,因为我是一个初学者。

pom文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.Ideng</groupId>
    <artifactId>helloworld</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>HelloWorldExample</name>
    <description>hello world example</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


</project>

1 个答案:

答案 0 :(得分:0)

我从开始创建项目时将弹簧版本从2.0.0更改为2.0.1 SNAPSHOT