我的项目有休眠 l2 缓存并使用 ehcache 通过此配置进行管理
hibernate.cache.region.factory_class:org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
迁移到 Spring boot 2 后,我得到了这个异常
Caused by: java.lang.annotation.IncompleteAnnotationException: org.terracotta.statistics.Statistic missing element type
at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:81)
at com.sun.proxy.$Proxy151.type(Unknown Source)
at org.terracotta.statistics.StatisticsManager.parseStatisticAnnotations(StatisticsManager.java:114)
at org.terracotta.context.ContextManager.contextCreated(ContextManager.java:183)
at org.terracotta.context.ContextManager.getOrCreateTreeNode(ContextManager.java:136)
at org.terracotta.context.ContextManager.associate(ContextManager.java:114)
at org.terracotta.context.ContextManager.access$000(ContextManager.java:38)
at org.terracotta.context.ContextManager$1.withChild(ContextManager.java:57)
at org.terracotta.statistics.StatisticsManager.createOperationStatistic(StatisticsManager.java:55)
at org.terracotta.statistics.StatisticsManager.createOperationStatistic(StatisticsManager.java:50)
at net.sf.ehcache.statistics.StatisticBuilder$OperationStatisticBuilder.build(StatisticBuilder.java:79)
at net.sf.ehcache.Cache.<init>(Cache.java:268)
at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:305)
at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:223)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:783)
at net.sf.ehcache.CacheManager.doInit(CacheManager.java:470)
at net.sf.ehcache.CacheManager.init(CacheManager.java:394)
... 42 common frames omitted
问了一些问题后,我发现 ehcache 2x 和 3 x 在我的项目中都有,异常原因是这样,但是当排除 2x 时,请参阅 spring 需要启动 2 x。如何解决这个问题