Spring Boot 2 Upgrade无法将类名称解析为属性

时间:2019-06-07 07:00:32

标签: java spring spring-boot cxf

我们有一个应用程序,其中我们的一个内部库定义了一个像这样的bean

<bean id="myBean" class="${myBean.type}"/>

我们有一个Spring Cloud Config Server,它在启动时向该应用程序提供属性,其中还包含属性myBean.type。目前,此设置运行良好,没有任何问题。然后,我对pom进行了以下更改

更早

<spring.boot.version>1.5.16.RELEASE</spring.boot.version>
<spring.cloud.version>Edgware.RELEASE</spring.cloud.version>
<spring.version>4.3.19.RELEASE</spring.version>

现在

<spring.boot.version>2.0.9.RELEASE</spring.boot.version>
<spring.version>5.0.13.RELEASE</spring.version>
<spring.cloud.version>Finchley.SR2</spring.cloud.version>

然后我在启动时开始出现此错误

An attempt was made to call the method org.springframework.beans.factory.support.BeanDefinitionBuilder.addConstructorArg(Ljava/lang/Object;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder; but it does not exist. Its class, org.springframework.beans.factory.support.BeanDefinitionBuilder, is available from the following locations:

    jar:file:/I:/Library/MavenRepository/org/springframework/spring-beans/5.0.13.RELEASE/spring-beans-5.0.13.RELEASE.jar!/org/springframework/beans/factory/support/BeanDefinitionBuilder.class

It was loaded from the following location:

    file:/I:/Library/MavenRepository/org/springframework/spring-beans/5.0.13.RELEASE/spring-beans-5.0.13.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.beans.factory.support.BeanDefinitionBuilder

为此,我从所有依赖它的jar中排除了工件org.apache.cxf:cxf-api:jar:2.7.18:compile,并将cxf jar版本升级到3.2.5。现在启动了,但是却给了我以下错误:

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [${myBean.type}] for bean with name 'myBean' defined in class path resource [xyz.xml]; nested exception is java.lang.ClassNotFoundException: ${myBean.type}

我不确定是否删除cxf-api会导致此问题,或者是Spring Boot 2的升级,还是这里出现了其他问题?

0 个答案:

没有答案