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}"这是什么异常
时间: 2024-03-11 09:51:24 浏览: 30
这个异常表示在 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 会自动将占位符替换为属性值。需要注意的是,如果属性值不存在,会抛出类似的异常。