【问题标题】:Integrate Spring Cloud Brixton.M1 into Spring Boot 1.2.6 application?将 Spring Cloud Brixton.M1 集成到 Spring Boot 1.2.6 应用程序中?
【发布时间】:2015-12-26 23:51:22
【问题描述】:

在我当前的 pom.xml 设置中,我似乎遗漏了一些东西。目前我有一个配置了启动器的 Spring Boot 应用程序。

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

现在我想将此应用程序与 Spring Cloud Brixton.M1 集成。根据文档,我需要添加以下块:

<repositories>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>http://repo.spring.io/milestone</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories> 
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-parent</artifactId>
            <version>Brixton.M1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

并添加例如 Spring Cloud Turbine AMQP。 org.springframework.cloud spring-cloud-starter-turbine-amqp

我还注释了 Spring Boot 启动类:

@EnableTurbineAmqp

但现在当我启动应用程序时,我收到以下错误消息:

线程“主”java.lang.NoSuchMethodError 中的异常:org.springframework.core.ResolvableType.forInstance(Ljava/lang/Object;)Lorg/springframework/core/ResolvableType;

类路径上似乎有 2 个版本的 Spring Core 存在冲突。有排除一个或另一个的首选方法吗?

【问题讨论】:

  • Spring Cloud 依赖于 Spring 4.2,而 Spring Boot 1.2 依赖于 Spring 4.1。您可以简单地将 spring.version 添加为您的 pom 的属性并将其设置为 4.2.1.RELEASE 但这可能会破坏某些 Spring Boot 功能(尽管我希望它可以正常工作)。

标签: spring maven-2 spring-boot maven-3 spring-cloud


【解决方案1】:

Spring Cloud Brixton M1 需要 Spring Boot 1.3.x

【讨论】:

    猜你喜欢
    • 2021-09-08
    • 2020-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-13
    • 2018-06-09
    • 2018-03-02
    相关资源
    最近更新 更多