idea启动项目报错:
No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath:jar:file:/D:/Codes/classes/artifacts/Codes_war_exploded/WEB-INF/lib/ehcache-core-2.4.3.jar!/ehcache-failsafe.xml
解决方法:在resources下面添加ehcache.xml文件
ehcache.xml内容:
<?xml version="1.0" encoding="UTF-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://www.ehcache.org/ehcache.xsd"> <!-- 磁盘缓存位置 --> <diskStore path="java.io.tmpdir"/> <!-- 默认缓存 --> <defaultCache maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" maxElementsOnDisk="10000000" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU"> <persistence strategy="localTempSwap"/> </defaultCache> </ehcache>
然后在application.yml下添加:
spring: cache: ehcache: config: classpath:ehcache.xml
pom.xml里面添加:
<dependency> <groupId>org.ehcache</groupId> <artifactId>ehcache</artifactId> <version>3.7.1</version> </dependency>
重启,解决啦!!!!