【问题标题】:spring core version updation in spring boot parent starter 1.5.10.RELEASEspring boot parent starter 1.5.10.RELEASE 中的 spring 核心版本更新
【发布时间】:2018-12-15 01:24:00
【问题描述】:

这是我拥有的 maven 依赖项

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.10.RELEASE</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
  </dependencies>

我想要实现的是,将弹簧芯从 4.3.14.RELEASE 更改为 4.3.4.RELEASE。是的,默认情况下,spring boot starter 使用的是 spring core 4.3.14,它可以扩展到 5.0.7.RELEASE,因为我尝试排除 spring-core 并包含 4.3.4.RELEASE

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.10.RELEASE</version>
            <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>
            </exclusions>
                <scope>import</scope>
            <type>pom</type>
        </dependency>
       <dependency>
               <groupId>org.springframework</groupId>
               <artifactId>spring-core</artifactId>
               <version>4.3.4.RELEASE</version>
      </dependency>
</dependencies>

当我尝试构建它时,会引发以下预期

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Unsatisfied dependency expressed through method 'setFilterChainProxySecurityConfigurer' parameter 1; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.convert.support.DefaultConversionService.getSharedInstance()Lorg/springframework/core/convert/ConversionService;

手动添加每个依赖项是不可能的,因为应用程序使用了大量的依赖项,并且与其他依赖项的兼容性将是另一项艰巨的工作。

那么有什么解决方法吗?

注意:- 尝试使用 spring framework-bom 和 spring IO,但没有找到任何解决方案,也许我错过了一些东西。欢迎提供这些示例。

【问题讨论】:

    标签: spring spring-boot maven-3 spring-io maven-bom


    【解决方案1】:

    你真的不应该这样做。 Spring Framework > Spring Boot > Spring Cloud > Data Flow 管理这些依赖项都是有原因的。您应该让 spring 处理依赖关系并根据需要升级您的实现。

    https://spring.io/blog/2016/04/13/overriding-dependency-versions-with-spring-boot

    更详细地回答这个问题。

    想要这样做是合理的,但应该这样做 谨慎,因为新版本的传递依赖可以 在 Spring 中轻松破坏依赖于旧版本的功能 开机。当您执行此操作并应用以下修复之一时,您将 让自己脱离 Spring Boot 的依赖管理和 说“嘿,我知道我在做什么,相信我。”很遗憾, 有时您需要这样做才能利用新的 第三方库中的功能。如果您不需要新版本 Reactor (或任何其他外部传递依赖项) 需要),那就不要这样做了,只要坚持快乐的道路,让Spring 启动管理依赖项。

    【讨论】:

      猜你喜欢
      • 2018-09-26
      • 2018-05-14
      • 2021-07-08
      • 2019-12-26
      • 2018-12-10
      • 2023-03-12
      • 1970-01-01
      • 1970-01-01
      • 2020-06-02
      相关资源
      最近更新 更多