ehcache / ehcache3

Ehcache 3.x line
http://www.ehcache.org
Apache License 2.0
2k stars 579 forks source link

JCache: Embededd programatic auto-configuration #2776

Open cdalexndr opened 4 years ago

cdalexndr commented 4 years ago

When initializing the CacheManager, an URI can be given or configured by ehcache.jsr107.config.default property when using default URI, to configure the cache manager using an xml configuration file. This embedded auto-configuration helps to configure the CacheManager using JCache that may request a CacheManager at any point in application.

The same cannot be done using programatic configuration because by default an empty configuration is used: https://github.com/ehcache/ehcache3/blob/4f5ed860b3488c2b2b3424575692a5d5ac3df8d0/107/src/main/java/org/ehcache/jsr107/EhcacheCachingProvider.java#L322-L336

A possible solution is to provide a property (maybe the same ehcache.jsr107.config.default) that contains a DefaultConfiguration class implementation that is instantiated and used instead of the default empty configuration.

chrisdennis commented 1 year ago

A simpler solution would be to just stash the "default" configuration object in the system properties... that said I'm interested to understand more about the use case that gets us here before moving forward with implementing anything.