线程“主”中的异常java.lang.NoSuchMethodError:org.springframework.boot.builder.SpringApplicationBuilder。<init>([Ljava / lang / Class;)

时间:2019-08-10 08:09:52

标签: maven spring-boot pom.xml

我试图通过Web套接字运行spring boot项目。启动应用程序工作正常,后来当我开始为pom文件添加其他依赖项(如AWS SQS)时,该项目无法运行。

我得到的错误是

线程“ main”中的异常java.lang.NoSuchMethodError:org.springframework.boot.builder.SpringApplicationBuilder。([Ljava / lang / Class;)V

这是pom文件。

<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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.javainuse</groupId>
    <artifactId>boot-websocket</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>boot-websocket</name>
    <description>Demo project for Spring Boot</description>
    <packaging>jar</packaging>

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

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <version>2.1.3.RELEASE</version>
            <exclusions>
                <exclusion>
                    <artifactId>logback-classic</artifactId>
                    <groupId>ch.qos.logback</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>log4j-over-slf4j</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>2.1.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.1.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
            <version>2.1.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20180813</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-aws-messaging</artifactId>
            <version>2.1.2.RELEASE</version>
        </dependency>

    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Greenwich.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

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

</project>

1 个答案:

答案 0 :(得分:-1)

在application.properties中定义SQS网址:

input[type=search] { -webkit-appearance: textfield; -webkit-box-sizing: content-box; font-family: inherit; font-size: 100%; border: none; } input::-webkit-search-decoration, input::-webkit-search-cancel-button { display: none; } #package-search input[type=search] { color: transparent; display: inline-block; width: 80px; height: 56px; background: #fff url(assets/img/img/icon/search-b.png) no-repeat 30px 18px; background-size: 23px auto; border-radius: 28px; cursor: pointer; margin-top: 10px; -webkit-transition: all .5s; -moz-transition: all .5s; transition: all .5s; padding-left: 0; } #package-search input[type=search]:hover { background-color: pink; } #package-search input[type=search]:focus { width: 380px; padding-left: 70px; padding-right: 20px; color: #343434; background-color: pink; cursor: auto; } #package-search input::-moz-placeholder { color: transparent; } #package-search input::-webkit-input-placeholder { color: transparent; }