Expose SDK classes for loading by a ServiceLoader
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 51
Description
Java has a class [java.util.ServiceLoader ](https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/util/ServiceLoader.html) (in this package available from JDK6 onwards).
> A facility to load implementations of a service.
> A service is a well-known interface or class for which zero, one, or many service providers exist. A service provider (or just provider) is a class that implements or subclasses the well-known interface or class. A ServiceLoader is an object that locates and loads service providers deployed in the run time environment at a time of an application's choosing. Application code refers only to the service, not to service providers, and is assumed to be capable of choosing between multiple service providers (based on the functionality they expose through the service), and handling the possibility that no service providers are located.
**Feature request**: Please support ServiceLoader by placing the required files in META-INF/services.
**Background**
You may already have heard of [SubstrateVM](https://github.com/oracle/graal/tree/master/substratevm) (part of [GraalVM](https://www.graalvm.org/))
> Substrate VM is a framework that allows ahead-of-time (AOT) compilation of Java applications under closed-world assumption into executable images or shared objects (ELF-64 or 64-bit Mach-O).
SubstrateVM supports _META-INF/services_ as part of the compilation process (done in https://github.com/oracle/graal/issues/563, released https://www.graalvm.org/docs/release-notes/#10-rc8).
So, if you support ServiceLoader, you add (part of) support for SubstrateVM, too.
**Example**
[Micronaut](https://micronaut.io/) can be compiled using SubstrateVM. One example for META-INF/services can be found at https://github.com/micronaut-projects/micronaut-core/tree/master/inject/src/main/resources/META-INF/services
Contributor guide
Assessment
This issue has not been assessed yet.