【发布时间】:2016-09-19 17:57:47
【问题描述】:
我正在使用@Configuration 并使用@Value 注释设置属性ehCacheConfig:
@Configuration
public class CacheConfig {
@Value("${configPath}")
private Resource ehCacheConfig;
}
但是在运行项目时出现如下错误。由于错误表明占位符属性configPath 没有被弹簧容器解析。谁能告诉我为什么?
java.io.FileNotFoundException: 无法打开 ServletContext 资源 [/${configPath}] org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141) org.springframework.cache.ehcache.EhCacheManagerUtils.parseConfiguration(EhCacheManagerUtils.java:107)
【问题讨论】: