17:15:56,387 ERROR ContextLoader:316 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'setmealServiceImpl': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'out_put_path' in value "${out_put_path}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues
当使用@Value时无法解析占位符,原因是我有两个spring.xml文件第一个文件导入了jdbc.properties,第二个Spring.xml有导入了freemarker.properties ,两个context:property-placeholder
冲突导致得。
解决方法:
删除其中一个context:property-placeholder ,只保留一个context:property-placeholder解决代码如下
<context:property-placeholder location="classpath:*.properties"/>
参考: