org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.redis.type' in value "${spring.redis.type}"
时间: 2023-08-14 20:10:11 浏览: 92
这个错误是因为Spring无法解析属性占位符`${spring.redis.type}`,可能是因为没有在配置文件中定义该属性或者属性的值为空。你需要检查配置文件中是否定义了该属性,如果没有,则需要添加该属性并设置属性值,如果已经定义了该属性,检查属性的值是否正确。另外,还需要确认你是否已经正确地将配置文件加载到Spring容器中。
相关问题
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}"
这个错误通常是因为没有正确配置Spring的依赖注入,具体可以检查以下几个方面:
1. 检查是否正确配置了Spring的依赖注入,特别是检查是否正确注入了需要的资源依赖。
2. 检查是否正确配置了数据源,特别是检查是否正确配置了连接池。
3. 检查是否正确配置了数据库驱动程序,特别是检查是否正确配置了驱动程序的类名。
如果以上几个方面都没有问题,还是出现这个错误,可以尝试重启应用程序或者重新编译构建应用程序,看看是否可以解决问题。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ruijinAiApi': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'other_picture_send_url' in value "${other_picture_send_url}"这是什么异常
这个异常表示在 Spring 框架中,创建名为 'ruijinAiApi' 的 bean 失败,因为无法解析占位符 '${other_picture_send_url}'。
通常情况下,Spring 配置文件中会使用占位符来引用配置文件中的属性值,以实现属性值的动态注入。而这个异常说明在配置文件中,没有定义名为 'other_picture_send_url' 的属性值,导致无法解析占位符。
解决方法是,在配置文件中定义名为 'other_picture_send_url' 的属性值。例如,可以在 Spring 的配置文件中添加以下内容:
```xml
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:config.properties</value>
</list>
</property>
</bean>
<bean id="ruijinAiApi" class="com.xxx.RuijinAiApi">
<property name="otherPictureSendUrl" value="${other_picture_send_url}"/>
</bean>
```
其中,'other_picture_send_url' 是在 config.properties 文件中定义的属性,value 属性指定了占位符的值,Spring 会自动将占位符替换为属性值。需要注意的是,如果属性值不存在,会抛出类似的异常。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![xlsx](https://img-home.csdnimg.cn/images/20210720083732.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)