I’ve already expressed my opinion that we should get rid of runtime modules in favor of build time modules so I’ll just link it here.
Even if you fix the classloader isolation issue, you then need to redesign our Spring context architecture. Right now it’s just a single context, which leaks module defined beans into other modules regardless, if they have dependency/awareness or not. Core needs to be a parent context and modules need to be completely separated from one another child contexts. Of course if you define dependency/awareness you need to put in place a mechanism for beans to be shared between modules, which you could replicate for required modules with child of child, but some hack would be needed for aware of modules.
I don’t know if there’s any way to support this concept with the Hibernate session. Consider how to make it work with Hibernate session and transaction spanning services from multiple modules.
What I’m trying to say is that if you think you solve one issue with runtime modules, more will come up… I don’t think it’s worth the effort given it’s not really used by implementers these days as most have some kind of builds in place already.