Ehcache配置文件加载方式
生活随笔
收集整理的這篇文章主要介紹了
Ehcache配置文件加载方式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
會在classpath路徑下找ehcache.xml配置文件
CacheManager?manager?=?new?CacheManager();???
也可以根據相對文件路徑來加載配置文件
CacheManager?manager?=?new?CacheManager(“src/ehcache.xml”);?.
通過相對與類路徑的位置加載 ??
URL?url?=?getClass().getResource(“/ehcache.xml”);?
CacheManager?manager?=?new?CacheManager(url);
通過流加載
InputSream?fis?=?new?FileInputStream(new?File(“src/config/ehcache.xml”).getAbsolutePath());
轉載于:https://my.oschina.net/crazyinsomnia/blog/3552
總結
以上是生活随笔為你收集整理的Ehcache配置文件加载方式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 黄聪:Destoon中循环嵌套Loop和
- 下一篇: java五子棋(可悔棋,人人+人机对弈)