弹簧靴的多个版本

时间:2019-10-20 02:00:08

标签: spring maven spring-boot

我正在运行Spring应用程序并收到以下错误:$ conda-build pybedgraph ... An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. Could not download https://pypi.io/packages/source/p/pybedgraph/pybedgraph-0.5.35.tar.gz

一个类似的问题已经回答in this question。在接受的答案中,Gergely Bacso指出问题是Spring Boot的多个版本。

堆栈跟踪列出了java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration$TomcatWebSocketConfiguration.websocketContainerCustomizer中发生的错误,当我尝试单击它时,会提供两个不同版本的Spring Boot,如下图所示:

two versions of spring boot

我的问题是:1)这就是为什么我遇到此异常吗? 2)如果是这样,我如何摆脱多余的版本? (或者,如果没有,还有其他想法为什么会这样?)

作为参考,这是我的pom.xml

SpringBootCondition.java

这是我的应用程序。yml:

<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>murraco</groupId>
    <artifactId>jwt-auth-service</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <name>spring-boot-jwt</name>

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

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

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.8</version>
        </dependency>

        <dependency>
            <!-- Setup Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <!-- JPA Data (Repositories, Entities, Hibernate, etc..) -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <!-- Starter for using Spring Security -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <!-- Make method based security testing easier -->
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- Automatically restart whenever files on the classpath change -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <!-- Automated JSON API documentation for API's built with Spring -->
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.7.0</version>

        </dependency>
        <dependency>
            <!-- Generate beautiful documentation from a Swagger-compliant API. -->
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.7.0</version>
        </dependency>
        <dependency>
            <!-- JSON Web Token Support -->
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.7.0</version>
        </dependency>
        <dependency>
            <!-- Model Mapper -->
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <version>1.1.0</version>
        </dependency>
    </dependencies>

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

</project>

当我运行Maven依赖关系树时,我看到以下内容:

spring:
  datasource: #TODO replace application.yml with an xml or java config file
    url: jdbc:${DBURL} #localhost/taskorchard
    username: ${DBUSER}
    password: ${DBPASSWORD}
  tomcat:
    max-wait: 20000
    max-active: 50
    max-idle: 20
    min-idle: 15
  jpa:
    hibernate:
      ddl-auto: validate
    properties:
      hibernate:
        dialect: org.hibernate.dialect.PostgreSQLDialect
        format_sql: true
        id:
          new_generator_mappings: false

server:
   port: 8080 # This is the default port anyway, but you can change it here

security:
  jwt:
    token:
      secret-key: secret-key
      expire-length: 300000 # 5 minutes duration by default: 5 minutes * 60 seconds * 1000 miliseconds

UserController:
  signin: Authenticates user and returns its JWT token.
  signup: Creates user and returns its JWT token
  delete: Deletes specific user by username
  search: Returns specific user by username
  me: Returns current user's data

1 个答案:

答案 0 :(得分:1)

好的,我知道了。我去了File-> Project结构,在那里看到spring-boot-starter-test.2.2.0。当我删除它时,起初我不知道发生了什么,因为我以前排除了log4j.logger-classic模块,因为与log4j版本的冲突不同,所以当程序正确运行时我看不到日志,不知道它正在运行。

如果您有类似的问题,并且无法解决此问题,我会尽力帮助您。