Hello everyone,

I have `Module module`. If this module is automatic I need to get the list of 
all its services/providers, so,
as I understand the only way to do it is to read its META-INF/services folder. 
I tried:

if (module.getDescriptor().isAutomatic()) {
    ClassLoader classLoader = module.getClassLoader();
    Enumeration<URL> resources = classLoader.getResources("META-INF/services/");
    while (resources.hasMoreElements()) {
            URL resource = resources.nextElement();
            ...
    }
}

but it doesn't work. All `resource`s have same path ending in 
`....META-INF/service`.
I tried:

    ModuleReference reference = ... ;
    var entries = reference.open().list().collect(Collectors.toList());

It worked, but I need only one folder, but not all with all classes etc. Could 
anyone what is the optimal way to do it?

Best regards, Pavel

Reply via email to