-
Notifications
You must be signed in to change notification settings - Fork 41.3k
Reinstate support for Ehcache 3 #30002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@chrisdennis Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
Thanks, @chrisdennis.
Thanks for this. Unfortunately, it doesn't quite meet the requirements that we have for some of Kafka's modules. I implemented something earlier this year which should work for both cases, I just haven't had a chance to merge it yet.
I don't think we have any dependencies that have taken this approach just yet, but I don't think it'll be a problem.
Spring Boot supports JTA-based transaction coordination either by retrieving the |
3b37102
to
e3329f4
Compare
@pivotal-cla This is an Obvious Fix This reinstates previously existing code and introduces no new IP. |
@chrisdennis You’ll need to sign the CLA, I’m afraid. The changes proposed here are not considered to be obvious as they will result in a change in functionality. |
@wilkinsona no problem... I figured I would see what you guys thought before I went ahead and engaged with the bureaucracy on this end. FYI: the alpha release referenced here is likely very close to what will become the 3.10.0 GA release. That should happen next week. Once I have that out I'll update the deps here and remove the draft status from this PR. |
e3329f4
to
cfe0d49
Compare
@chrisdennis Thank you for signing the Contributor License Agreement! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, @chrisdennis. I've left a few comments for your consideration when you have a minute.
@@ -81,7 +86,10 @@ | |||
* @author Ryon Day | |||
*/ | |||
@ClassPathExclusions("hazelcast-client-*.jar") | |||
class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see the connection between this change (and deleting AbstractCacheAutoConfigurationTests) and reinstating support for EhCache 3. I'd prefer to make the changes as minimal as possible and leave this as-is if we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that AbstractCacheAutoConfigurationTests was only introduced to allow the Ehcache tests to have a @ClassPathExclusions annotation on the Ehcache 2 JARs. The bug that caused that to be necessary was fixed in Ehcache 2 a while back... and regardless Ehcache 2 I assume isn't part of Spring Boot 3.x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I can't recall the exact reason. Folding everything back into a single class is a good thing to do if we can, but it's the sort of thing that we prefer to do separately. If, as you suspect, a bug's been fixed in EhCache 2 such that the separate classes are no longer necessary we can make that change in all our currently maintained branches and not just in main.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I recall correctly without digging through the issue-tracker we fixed this in Ehcache 3 by shading and relocating some library version clashes that meant the two couldn't co-exist. Regardless, I'll back these changes out of this PR.
void hibernate2ndLevelCacheWithJCacheAndHazelcast() { | ||
String cachingProviderFqn = HazelcastServerCachingProvider.class.getName(); | ||
String configLocation = "classpath:hazelcast.xml"; | ||
void hibernate2ndLevelCacheWithJCacheAndEhCache3() { | ||
String cachingProviderFqn = EhcacheCachingProvider.class.getName(); | ||
String configLocation = "ehcache3.xml"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be left as it was before. We don't have to stop using Hazelcast here in order to restore support for EhCache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started out here with a simple revert of the commit that removed Ehcache 3 support. That's why this came in. I can remove as you wish.
- revert
Hibernate2ndLevelCacheIntegrationTests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please.
"ehcache-transactions" { | ||
classifier = 'jakarta' | ||
}, | ||
"ehcache-clustered" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to list modules in alphabetical order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- modules should be in alphabetical order
@@ -2,7 +2,7 @@ | |||
== IO | |||
If your application needs IO capabilities, see one or more of the following sections: | |||
|
|||
* *Caching:* <<io#io.caching, Caching support with Hazelcast and more>> | |||
* *Caching:* <<io#io.caching, Caching support EhCache, Hazelcast and more>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we keep the "with" here please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Artifact of the initial revert.
- restore correct grammar in
io.adoc
Do you prefer a separate commit for review changes, or a force push? |
Either's fine. Thank you. We'll squash multiple commits into one as part of merging so a force-push is probably slightly easier to process. |
cfe0d49
to
160c94a
Compare
160c94a
to
748b4dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great now, @chrisdennis. Thank you.
@chrisdennis thank you for the follow-up and for making your first contribution to Spring Boot. |
This is a prototype of the restoration of Ehcache 3 support to Spring Boot. Ehcache uses Gradle feature variants (with appropriate capabilities) to model the split "Jakarta/Java EE" landscape. These are exposed in Maven as artifacts with 'jakarta' classifiers with appropriate optional dependencies. I've therefore implemented a solution to #29298 as a prerequisite here.
Currently this is depending on an alpha release of Ehcache 3.10, hence it's only a draft PR, but I wanted to get this out there for two reasons:
ehcache-transactions
module. The transactions module allows Ehcache instances to be exposed as XA resources and participate in 2PC managed by a JTA transaction manager. It's not clear to me how this relates to Springs caching support - I'm not sure how or why a user would need this dependency in a Spring (Boot) context.