Spring Boot 2.0.6配置Actuator以及跟ehcache-core低版本共存问题(net/sf/ehcache/statistics/StatisticsGateway)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/penker_zhao/article/details/84856813

我们新的开发平台基于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,就不会再出现标题中未找到该方法的问题了。
参考说明:

https://github.com/spring-projects/spring-boot/issues/4621

猜你喜欢

转载自blog.csdn.net/penker_zhao/article/details/84856813