Expose SDK classes for loading by a ServiceLoader
- Lingua principale
- Java
- Stelle
- 2.6k
- Fork
- 1k
- Merge medio
- 2g 9h
- PR unite (30g)
- 51
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia esaminando la documentazione di Java ServiceLoader collegata nell’issue e il packaging delle risorse esistente nel repository. Identifica quali classi SDK sono destinate a essere provider di servizi e dove devono trovarsi le risorse META-INF/services. Il lavoro è completato quando i file dei provider di servizi richiesti sono inclusi nel pacchetto e ServiceLoader è in grado di individuare le classi esposte, con una verifica per i moduli SDK pertinenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- build-system
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100