Class MetaInfServices

java.lang.Object
com.github.mizool.core.MetaInfServices

public final class MetaInfServices extends Object
  • Method Details

    • instances

      @Deprecated(forRemoval=true, since="8.1") public static <S> Iterable<S> instances(Class<S> service)
      Deprecated, for removal: This API element is subject to removal in a future version.
      When it was introduced years ago, the point of this method was to ensure the ServiceLoader call always used the classloader of the service class. At the time, this seemed to be important, even essential, so it was decided to ensure this "correct" usage.

      Fast-forward to 2025, this turned out to be harmful: in environments with layered classloaders like Quarkus, this limits the returned service implementations to those from library jars and omits those supplied by the application.

      For this reason, this method now uses the current thread's context classloader. Consequently, calling it is now equivalent to calling ServiceLoader.load(Class). Calls should therefore be replaced as this method is going to be removed.