@@ -23,6 +23,14 @@ public class IntegrationsLoader {
2323 private IntegrationsLoader () {
2424 }
2525
26+ private static class PluginClassLoaderHolder {
27+ private static final ClassLoader CLASS_LOADER = ClassLoaderFactory .forPluginDir ();
28+ }
29+
30+ private static ClassLoader getClassLoader () {
31+ return PluginClassLoaderHolder .CLASS_LOADER ;
32+ }
33+
2634 /**
2735 * Loads the best suited service provider, i.e. the one with the highest priority that is supported.
2836 * <p>
@@ -44,7 +52,7 @@ public static <T> Optional<T> load(Class<T> clazz) {
4452 * @param <T> Type of the service
4553 */
4654 public static <T > Optional <T > loadSpecific (Class <T > clazz , String implementationClassName ) {
47- return ServiceLoader .load (clazz , ClassLoaderFactory . forPluginDir ()).stream ()
55+ return ServiceLoader .load (clazz , getClassLoader ()).stream ()
4856 .filter (provider -> provider .type ().getName ().equals (implementationClassName ))
4957 .map (ServiceLoader .Provider ::get )
5058 .findAny ();
@@ -61,7 +69,7 @@ public static <T> Optional<T> loadSpecific(Class<T> clazz, String implementation
6169 * @return An ordered stream of all suited service providers
6270 */
6371 public static <T > Stream <T > loadAll (Class <T > clazz ) {
64- return loadAll (ServiceLoader .load (clazz , ClassLoaderFactory . forPluginDir ()), clazz );
72+ return loadAll (ServiceLoader .load (clazz , getClassLoader ()), clazz );
6573 }
6674
6775 /**
0 commit comments