Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adsCasController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adsCasService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.datasource.druid.driverClassName' in value "${spring.datasource.druid.driverClassName}"
时间: 2023-08-26 08:15:32 浏览: 599
这个错误通常是因为没有正确配置Spring的依赖注入,具体可以检查以下几个方面:
1. 检查是否正确配置了Spring的依赖注入,特别是检查是否正确注入了需要的资源依赖。
2. 检查是否正确配置了数据源,特别是检查是否正确配置了连接池。
3. 检查是否正确配置了数据库驱动程序,特别是检查是否正确配置了驱动程序的类名。
如果以上几个方面都没有问题,还是出现这个错误,可以尝试重启应用程序或者重新编译构建应用程序,看看是否可以解决问题。
相关问题
WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dtoMapper': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demandResponseEventMapper': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demandResponseEventService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'demandResponseEventPublisher': Unsatisfied dependency expressed through field 'jmsTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'l' defined in class path resource [com/avob/openadr/server/common/vtn/VtnConfigRabbitmqBroker.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.jms.core.JmsTemplate]: Factory method 'externalJmsTemplate' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalConnectionFactory' defined in class path resource [com/avob/openadr/server/common/vtn/VtnConfigRabbitmqBroker.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.jms.ConnectionFactory]: Factory method 'externalConnectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: com/rabbitmq/jms/admin/RMQConnectionFactory
根据你提供的信息,看起来是一个Spring Boot项目的启动问题。具体来说,`accountController`这个bean初始化失败,因为它依赖于`demandResponseEventPublisher`这个bean,而`demandResponseEventPublisher`又依赖于`jmsTemplate`这个bean。进一步分析,发现`jmsTemplate`依赖于`externalConnectionFactory`这个bean,而`externalConnectionFactory`初始化失败,因为它依赖于`com.rabbitmq.jms.admin.RMQConnectionFactory`这个类,但这个类找不到。这可能是由于缺少相关的依赖或版本不兼容等问题引起的。您可以检查项目的依赖是否正确,以及相关依赖的版本是否与您使用的Spring版本兼容。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mpAccountController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mpAccountServiceImpl': Invocation of init method failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: 是什么意思
这个错误信息表明在创建名为 "mpAccountController" 的 bean 时,依赖注入失败了。具体地,是在初始化名为 "mpAccountServiceImpl" 的 bean 时出现了问题,导致依赖注入失败。其根本原因是在执行初始化方法时发现了一个 SQL 语法错误,可能是因为 SQL 语句中存在语法错误或表不存在等问题。
简而言之,很可能是在执行 SQL 语句时发生了错误,需要检查 SQL 语句是否正确,或者检查数据库中是否存在相应的表。
阅读全文