如果你正在使用 @SpringBootTest ,那么你可以添加 @TestPropertySource(properties={"net.sf.ehcache.disabled=true"}) 到你的考试班。
@SpringBootTest
@TestPropertySource(properties={"net.sf.ehcache.disabled=true"})
我们需要限制在缓存中添加元素。
这可以通过设置net.sf.ehcache.disabled系统属性来完成
您可以通过设置此属性 -Dnet.sf.ehcache.disabled=true 从命令 线
-Dnet.sf.ehcache.disabled=true
您还可以在右键单击项目中提供此属性: Run Configuration -> Arguments tab -> add in VM Arguments box
Run Configuration -> Arguments tab -> add in VM Arguments box