我已经配置类似下面春天ignoreResourceNotFound不工作
<bean id="applicationHostProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="ignoreResourceNotFound" value="true"></property>
<property name="locations">
<list>
<value>classpath:applicationHost.properties</value>
</list>
</property>
</bean>
从我的Spring bean我注入属性文件
@Value("#{appsDeployedProperties}")
private Properties appsDeployedProperties;
既然我已经设置ignoreResourceNotFound =真属性文件,如果找不到属性文件,我不期待任何错误。
但是我的春天上下文初始化失败,如果属性文件丢失。我在这里做错了什么?谢谢你的帮助。
错误堆栈跟踪:
错误名为 '上instanceConfigurati ' 创建豆:不满意依赖通过现场 'appsDeployedProperties' 表示:前 PRESSION解析失败;嵌套的异常是org.springframework.expression.spel .SpelEvaluationException:EL1008E:(pos 0):属性或字段'appsDeployedProper ties'无法在类型为'org.springframework.beans.factory.confi的对象上找到 g.BeanExpressionContext ' - 也许不公开?嵌套异常是org.springfram ework.beans.factory.BeanExpressionException:表达式解析失败;嵌套e xception is org.springframework.expression.spel.SpelEvaluationException:EL1008E :(pos 0):无法在对象上找到属性或字段'appsDeployedProperties' f type'org.springframework.beans.factory.config.BeanExpressionContext ' - 也许 不公开?嵌套的异常是org.springframework.beans.factory.UnsatisfiedDe pendencyException:创建名为'instanceConfiguration'的bean时出错:Unsati 通过字段'appsDeployedProperties'表示的已满依赖:表达式pa 解析失败;嵌套异常是org.springframework.expression.spel.SpelEvalua tionException:EL1008E:(pos 0):属性或字段'appsDeployedProperties'canno 在类型'org.springframework.beans.factory.config.BeanExpre ssionContext' - 可能不公开?嵌套异常是org.springframework.beans .factory.BeanExpressionException:表达式解析失败;嵌套的异常是 org.springframework.expression.spel.SpelEvaluationException:EL1008E:(pos 0):P roperty或字段'appsDeployedProperties'无法在'org类型的对象上找到' .springframework.beans.factory.config.BeanExpressionContext' - 可能不公开?在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP ostProcessor $ AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j ava:569)〜[spring-beans-4.3.2.RELEASE.jar!/:4.3 .2.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject (InjectionMetadata.java:88)〜[spring-beans-4.3.2.RELEASE.jar!/:4.3.2.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP 个ostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java :349)〜[弹簧豆-4.3.2.RELEASE.jar /:4.3.2.RELEASE]
添加堆栈跟踪,请 – Jens
添加了错误的堆栈跟踪 – lives
可以请你重新设置堆栈跟踪,它不是以这种形式可读 – Jens