0
我使用@Configuration
,並設置屬性ehCacheConfig
與@Value
註釋:佔位性質不解決
@Configuration
public class CacheConfig {
@Value("${configPath}")
private Resource ehCacheConfig;
}
但在運行項目錯誤時,如下發生。由於錯誤表明佔位符屬性configPath
未被spring容器解析。誰能告訴我爲什麼?
java.io.FileNotFoundException:無法打開ServletContext的資源 [/ $ {}用configPath] org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141) org.springframework .cache.ehcache.EhCacheManagerUtils.parseConfiguration(EhCacheManagerUtils.java:107)
我添加的屬性在文件<上下文:屬性佔位符忽略資源未找到= 「真」 位置= 「類路徑*:base.properties」/> ,我想這可以使它像使用PropertySource – lawrence
你可以發佈base.properties的內容? – codependent
configPath = classpath:ehcache.xml authenticationCacheName = authenticationCache authorizationCacheName = authorizationCache – lawrence