S - The service typepublic abstract class AbstractCloudServiceConnectorFactory<S>
extends org.springframework.beans.factory.config.AbstractFactoryBean<S>
implements org.springframework.cloud.service.CloudServiceConnectorFactory<S>
This factory uses the service creator provided through the constructor to create services. If the service name is provided it creates a service object based on the service bound to that name. Otherwise, it creates a singleton service and fails if it doesn't find a unique service of the expected type.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
serviceId |
| Constructor and Description |
|---|
AbstractCloudServiceConnectorFactory(java.lang.Class<S> serviceConnectorType,
org.springframework.cloud.service.ServiceConnectorConfig serviceConnectorConfiguration) |
AbstractCloudServiceConnectorFactory(java.lang.String serviceId,
java.lang.Class<S> serviceConnectorType,
org.springframework.cloud.service.ServiceConnectorConfig serviceConnectorConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected S |
createInstance() |
S |
createService() |
java.lang.Class<?> |
getObjectType() |
java.lang.String |
getServiceId() |
void |
setCloud(org.springframework.cloud.Cloud cloud)
Set the cloud, for internal testing purpose only.
|
void |
setServiceConnectorType(java.lang.Class<? extends S> serviceConnectorType) |
public AbstractCloudServiceConnectorFactory(java.lang.String serviceId,
java.lang.Class<S> serviceConnectorType,
org.springframework.cloud.service.ServiceConnectorConfig serviceConnectorConfiguration)
serviceId - Optional service name property. If this property is null, a unique service of the expected type
(redis, for example) needs to be bound to the application.serviceConnectorType - the class of the service connector that will be returnedserviceConnectorConfiguration - configuration to be applied to the service connectorpublic AbstractCloudServiceConnectorFactory(java.lang.Class<S> serviceConnectorType, org.springframework.cloud.service.ServiceConnectorConfig serviceConnectorConfiguration)
public void setCloud(org.springframework.cloud.Cloud cloud)
For normal usage, the InitializingBean approach will create (if needed) a CloudFactory and obtain a
Cloud from it.
cloud - the Cloud instance describing the discovered runtime environmentpublic void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanafterPropertiesSet in class org.springframework.beans.factory.config.AbstractFactoryBean<S>java.lang.Exceptionprotected S createInstance() throws java.lang.Exception
createInstance in class org.springframework.beans.factory.config.AbstractFactoryBean<S>java.lang.Exceptionpublic S createService()
createService in interface org.springframework.cloud.service.CloudServiceConnectorFactory<S>public java.lang.Class<?> getObjectType()
public java.lang.String getServiceId()
getServiceId in interface org.springframework.cloud.service.CloudServiceConnectorFactory<S>public void setServiceConnectorType(java.lang.Class<? extends S> serviceConnectorType)