The current ServiceLoader mechanism and Java Modules have a limited set of options to provide an instance for a service from a module. Or you use the constructor, or you use a static 'provider' method.
When interacting with frameworks like Spring this does not give a lot of flexibility. I described the problem statement and some ideas which could be considered for evolving the services support in the module system in this blog post: https://devcreativity.wordpress.com/2019/03/02/java-modules-wish-list-provide-services-using-lambda-functions-and-more/ I would appreciate if some of the oracle contributors that worked on the module system could read the post and provide me and the community with some feedback if such a change could be a good idea? Thanks in advance Tom