OpenFeign / OpenFeign/feign

Support ServiceLoader

Open
#944 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

proposal waiting for votes
Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

Java has a class java.util.ServiceLoader (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 (part of GraalVM)

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 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the repository's Java resource and build layout alongside the ServiceLoader documentation linked in the issue. Identify the required META-INF/services files and verify that ServiceLoader can discover the relevant providers; the issue names no repository files or tests, so completion criteria need maintainer confirmation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.