public final class ServiceLoader extends Object
Modifier and Type | Method and Description |
---|---|
static Object |
loadService(String propertyName,
String defaultFactory)
This method uses the algorithm below using the JAXWS Provider as an example.
|
static Object |
loadService(String propertyName,
String defaultFactory,
ClassLoader cl)
This method uses the algorithm below using the JAXWS Provider as an example.
|
public static Object loadService(String propertyName, String defaultFactory, ClassLoader cl)
1. If a resource with the name of META-INF/services/javax.xml.ws.spi.Provider exists, then its first line, if present, is used as the UTF-8 encoded name of the implementation class. 2. If the ${java.home}/lib/jaxws.properties file exists and it is readable by the java.util.Properties.load(InputStream) method and it contains an entry whose key is javax.xml.ws.spi.Provider, then the value of that entry is used as the name of the implementation class. 3. If a system property with the name javax.xml.ws.spi.Provider is defined, then its value is used as the name of the implementation class. 4. Finally, a default implementation class name is used.
propertyName
- The property name for the service to resolvedefaultFactory
- Default factory class name to be used when not able to resolve anythingcl
- The classLoader to be used for loading resolved servicepublic static Object loadService(String propertyName, String defaultFactory)
1. If a resource with the name of META-INF/services/javax.xml.ws.spi.Provider exists, then its first line, if present, is used as the UTF-8 encoded name of the implementation class. 2. If the ${java.home}/lib/jaxws.properties file exists and it is readable by the java.util.Properties.load(InputStream) method and it contains an entry whose key is javax.xml.ws.spi.Provider, then the value of that entry is used as the name of the implementation class. 3. If a system property with the name javax.xml.ws.spi.Provider is defined, then its value is used as the name of the implementation class. 4. Finally, a default implementation class name is used.This is equivalent to calling
loadService(String propertyName, String defaultFactory, ClassLoader cl)
passing in the Thread.currentThread().getContextClassLoader().propertyName
- The property name for the service to resolvedefaultFactory
- Default factory class name to be used when not able to resolve anythingCopyright © 2019 JBoss by Red Hat. All rights reserved.