Skip to content

Make JCachePropertiesCustomizer public #29542

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
mwerlitz opened this issue Jan 24, 2022 · 3 comments
Closed

Make JCachePropertiesCustomizer public #29542

mwerlitz opened this issue Jan 24, 2022 · 3 comments
Labels
for: external-project For an external project and not something we can fix

Comments

@mwerlitz
Copy link

mwerlitz commented Jan 24, 2022

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 24, 2022
@snicoll
Copy link
Member

snicoll commented Jan 24, 2022

@mwerlitz thanks for the suggestion. Can you please share the properties you'd like to set?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Jan 24, 2022
@mwerlitz
Copy link
Author

mwerlitz commented Jan 24, 2022

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.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 24, 2022
@philwebb
Copy link
Member

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.

@philwebb philwebb added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Jan 24, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

4 participants