public final class ServiceLoaderComponentLoader extends java.lang.Object implements ComponentLoader
ComponentLoader
implementation that uses a ServiceLoader
internally to load Component
s.
To use this class, you need to add the file META-INF/services/org.macroing.cit.ioc.component.Component
to your JAR-file. In this file, type, on separate lines, the fully qualified class names of the
Component
implementations you wish to load.
For more information, take a look at the Javadocs for the ServiceLoader
class in the official Java APIs.
Constructor and Description |
---|
ServiceLoaderComponentLoader()
Constructs a new
ServiceLoaderComponentLoader instance. |
Modifier and Type | Method and Description |
---|---|
java.util.Set<Component> |
load()
|
public ServiceLoaderComponentLoader()
ServiceLoaderComponentLoader
instance.public java.util.Set<Component> load()
Set
with the Component
s to load into a Container
instance.
If the order in which the Component
s are loaded, started and stopped is crucial, consider using a LinkedHashSet
. All Container
s will use the load order as the order to start and the reverse
of that order to stop them.
load
in interface ComponentLoader
Set
with the Component
s to load into a Container
instance.