Please make org.springframework.boot.autoconfigure.cache.JCachePropertiesCustomizer
public, so the properties that are used to initialize the CacheManager
can be customized by an application.
I would like to use the property replacement feature of EhCache in the configuration XML file.
At the moment this is not possible because the properties supplied when creating the CacheManager
in JCacheCacheConfiguration#createCacheManager
are empty and there seems to be no way to supply additional properties.
The code in JCacheCacheConfiguration#createCacheManagerProperties
is supposed to create these properties with the help of JCachePropertiesCustomizer
instances. But JCachePropertiesCustomizer
is not public so one has no possibility to supply additional props that may be used in the XML config file.
Comment From: snicoll
@mwerlitz thanks for the suggestion. Can you please share the properties you'd like to set?
Comment From: mwerlitz
I wanted to set a custom property to be able to use dynamically configured values from application.properties
that get referenced within ehcache.xml
.
But it turns out the documentation of javax.cache.spi.CachingProvider.getCacheManager(URI, ClassLoader, Properties)
is a bit misleading and EhCache currently only supports property replacement with real system properties in XML configuration files (see org.ehcache.xml.JaxbParsers
).
Looks like I need a feature request for EhCache first to also consider values from CacheManager.getProperties()
for property replacement there to make that work.
As a workaround I will now extract my properties from application context and convert them to system properties just before JCacheCacheConfiguration
will create the CacheManager
.
If you have a better idea please let me know.
Comment From: philwebb
It sounds like that's the best approach for now. If the EhCache enhancement gets implemented and we need to offer more customization options please comment back here.