-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
CacheManager
s that extend from AbstractTransactionSupportingCacheManager
, for example JCacheCacheManager
, support transaction awareness by wrapping the Cache
in a TransactionAwareCacheDecorator
. If enabled, the cache statistics provided by the Spring Boot Actuator project cease to work.
The problem is, that CachePublicMetrics#getCacheStatistics
search for a suitable CacheStatisticsProvider
by comparing the runtime type of the Cache
against the generic type of all registered CacheStatisticsProvider
s. This, of course, doesn't work if the Cache is wrapped in a completely different type.
As a workaround, I added a new AbstractJmxCacheStatisticsProvider<TransactionAwareCacheDecorator>
that contains the same implementation as JCacheCacheStatisticsProvider
(because we use JCacheCache
s).
We use Spring Boot 1.4.1, but I quickly checked the latest version on Github, and there doesn't seem to be any changes in this area.
I guess CachePublicMetrics#getCacheStatistics
should first unwrap TransactionAwareCacheDecorator
before trying to lookup a stats provider.