在将springboot从1.5.x升级到2.0.0时,我收到BeanCreationException 警告。该程序仍然可以运行,但是这些警告正在从我们的监视系统中触发警报,需要您的帮助才能删除这些警告。
我将dubbo与xml配置一起使用。谢谢。
spring-dubbo.xml:
<dubbo:application name="${dubbo.application.name}"
logger="${dubbo.application.logger}"/>
<dubbo:registry file="${dubbo.registry.file}"
protocol="zookeeper"
address="${dubbo.registry.address}"
timeout="${dubbo.provider.timeout}" id="cs_registry"/>
<dubbo:reference id="innerService"
version="${dubbo.provider.version}"
retries="${dubbo.provider.retries}"
这是我的财产
dubbo.application.name=cs-task-consumer
dubbo.application.logger=slf4j
dubbo.provider.timeout=10000
dubbo.provider.retries=0
dubbo.provider.version=1.0.0-DEV
dubbo.registry.address=10.25.112.33:2181
我的主要人:
@SpringBootApplication
@EnableScheduling
@ServletComponentScan
@ImportResource({
"classpath:META-INF/environments/dev/spring-dubbo.xml",
"classpath:task.xml"
})
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}
警告日志:
2019-03-22 10:15:46,317 [main] WARN [] [] o.s.b.f.s.DefaultListableBeanFactory
[1530] - Bean creation exception on non-lazy FactoryBean type check:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'innerService': Cannot resolve reference to bean 'cs_registry' while
setting bean property 'registry'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'cs_registry': Initialization of bean failed; nested exception is
org.springframework.beans.TypeMismatchException: Failed to convert property
value of type 'java.lang.String' to required type 'java.lang.Integer' for
property 'timeout'; nested exception is java.lang.NumberFormatException: For
input string: "${dubbo.provider.timeout}"