问题复现:
SpringBoot项目的service层,添加了@Value注解
@Value("${com.****.****.****.uploadUrl}")
private String uploadUr ;
导致项目启动时,抛出异常,异常如下:
问题描述
其他地方不动, 只是添加了@Value注解(相应配置已添加),启动就会报以下错误,
15:51:19.092 [INFO ] [fuxi-disruptor-fuxi_disruptor_consumer_-31] .NacosClientRegisterRepository[161]: register metadata success: /contract/icosLoanAfter/**
15:51:19.144 [INFO ] [fuxi-disruptor-fuxi_disruptor_consumer_-18] .NacosClientRegisterRepository[161]: register metadata success: /contract/IcosRepayMentDate/**
15:51:19.326 [INFO ] [fuxi-disruptor-fuxi_disruptor_consumer_-24] .NacosClientRegisterRepository[161]: register metadata success: /contract/icosWipedBadDebts/**
15:51:19.362 [INFO ] [fuxi-disruptor-fuxi_disruptor_consumer_-23] .NacosClientRegisterRepository[161]: register metadata success: /contract/wechatPayment/**
15:51:19.660 [WARN ] [main] letWebServerApplicationContext[559]: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'applyRecordController' defined in file [C:\workSpace\afs-contract\afs-contract-\afs-contract--biz\target\classes\com\gwmfc\icos\\common\controller\ApplyRecordController.class]: Unsatisfied dependency expressed through constructor parameter 7; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'RevokeHandleServiceImpl' defined in file [C:\workSpace\afs-contract\afs-contract-\afs-contract--biz\target\classes\com\gwmfc\icos\\common\service\impl\RevokeHandleServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 9; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
15:51:19.670 [INFO ] [main] b.d.d.DynamicRoutingDataSource[215]: dynamic-datasource start closing ....
15:51:19.673 [INFO ] [main] c.a.d.p.DruidDataSource [2032]: {dataSource-2} closing ...
15:51:19.678 [INFO ] [main] c.a.d.p.DruidDataSource [2104]: {dataSource-2} closed
15:51:19.679 [INFO ] [main] c.a.d.p.DruidDataSource [2032]: {dataSource-1} closing ...
15:51:19.681 [INFO ] [main] c.a.d.p.DruidDataSource [2104]: {dataSource-1} closed
15:51:19.682 [INFO ] [main] b.d.d.DynamicRoutingDataSource[219]: dynamic-datasource all closed success,bye
15:51:19.684 [WARN ] [main] tationConfigApplicationContext[1016]: Exception thrown from ApplicationListener handling ContextClosedEvent
org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'rabbitConnectionFactory': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:212) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:245) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:197) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicati