class AdapterServiceLoader {

    public <T extends AdapterServiceProvider> Optional<T> getServiceProvider(Class<T> klass, String adapterId) {
        MDC.put("adapterId", adapterId);

        Optional<T> serviceProvider;
        synchronized (serviceLoaders) {
            serviceProvider = StreamSupport.stream(getServiceLoader(klass).spliterator(), false)
                .filter(provider -> provider.getAdapterId().equalsIgnoreCase(adapterId))
                .findFirst();
        }
        return serviceProvider;
    }

    public  AdapterServiceLoader(AspspReadOnlyRepository aspspRepository,
                                Pkcs12KeyStore keyStore,
                                HttpClientFactory httpClientFactory,
                                LinksRewriter accountInformationLinksRewriter,
                                LinksRewriter paymentInitiationLinksRewriter,
                                boolean chooseFirstFromMultipleAspsps);

}