Fixes #19487
When Spring Boot creates Hazelcast configuration and the Hazelcast-Spring integration module is available on a classpath then inject SpringManagedContext into Hazelcast configuration.
This change makes it possible to inject Spring managed beans into objects instantiated by Hazelcast.
I'm not too familiar with Spring Boot so chances are the code is not idiomatic. It looks rather complex for what is basically an if-else condition. Any guidance is very much appreciated.
Comment From: jerrinot
the same change should be probably done in the client auto-configuration.
Comment From: jerrinot
I was also considering not to introduce the concept of Customizers
and keep it simple. Something along this lines:
try {
var context = new SpringManagedContext(appContext);
config.setManagedContext(context);
catch (ClassNotFoundError err) {
// the Hazelcast-Spring integration JAR not available on a classpath, that's OK
}
but this felt dirty. From the other hand - the current approach feels unnecessary complex.
Comment From: jerrinot
@ldziedziul, @wilkinsona: thanks to both of you for the review. I pushed a change simplifying the code and I'm now quite happy with how it looks. Please let me know what you think.
edit: s/not/now
Comment From: jerrinot
Hi @wilkinsona,
may I kindly ask you what are the next steps with this PR? Is there anything else I could do to help merge it? I see you added a flag "merge-with-amendments". What are these amendments?
Thanks a lot!
Comment From: wilkinsona
Thanks for asking, @jerrinot. There's nothing more for you to do. The amendments are just cosmetic changes to align with the project's code style. We'll take care of those as part of merging the changes. Work on 2.7 is only just getting started (we're in a planning phase at the moment) with the first milestone not due until 20 January.
Comment From: jerrinot
@wilkinsona thank you, that's very good to know!
Comment From: jerrinot
@snicoll many thanks for taking this over the finish line. Feel free to reach out to me if you need any help with anything Hazelcast-related!