我们新的开发平台基于spring boot 2.0.6搭建(还未整体使用spring cloud)添加了Spring Boot 2.0.6的actuator后,开发平台碰到了这个问题描述:
java.lang.NoSuchMethodError: net.sf.ehcache.Ehcache.getStatistics()Lnet/sf/ehcache/statistics/StatisticsGateway
解决方案如下:
ehcache-core最新的maven包发生了变化,变化如下:
<!-- https://mvnrepository.com/artifact/net.sf.ehcache/ehcache-core -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.6.11</version>
</dependency>
上面这个maven包,只到2.6.11
<!-- https://mvnrepository.com/artifact/net.sf.ehcache.internal/ehcache-core -->
<dependency>
<groupId>net.sf.ehcache.internal</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.10.5</version>
<scope>provided</scope>
</dependency>
上面更新到了比较新的版本,看了源码,并且有标题中的方法。所以在新的平台使用最新的Jar,就不会再出现标题中未找到该方法的问题了。