Class WiringInstantiator
java.lang.Object
org.apache.geode.Instantiator
org.springframework.data.gemfire.serialization.WiringInstantiator
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
public class WiringInstantiator
extends org.apache.geode.Instantiator
implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Apache Geode
Instantiator
that performs instance wiring using the Spring IoC container, allowing common
properties to be injected before the object is hydrated/deserialized. The newly created instances can be configured
either by relying on an existing bean definition (which acts as a template) or by providing an embedded configuration
through annotations.
Can reuse existing Instantiators
to optimize instance creation. If one is not provided,
it will fallback to reflection invocation.
By default, on initialization, the class will register itself as an Instantiator
through
Instantiator.register(Instantiator)
. This behaviour can be disabled through setAutoRegister(boolean)
.
Additionally, the instantiator registration is not distributed by default, to allow the application context
to be reused. This can be changed through setDistribute(boolean)
.- See Also:
-
BeanConfigurerSupport
BeanWiringInfoResolver
Autowired
-
Constructor Summary
ConstructorDescriptionWiringInstantiator
(Class<? extends org.apache.geode.DataSerializable> c, int classId) WiringInstantiator
(org.apache.geode.Instantiator instantiator) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
destroy()
org.apache.geode.DataSerializable
void
setAutoRegister
(boolean autoRegister) Sets the auto-registration of thisInstantiator
during the container startup.void
setBeanFactory
(org.springframework.beans.factory.BeanFactory beanFactory) void
setConfigurer
(org.springframework.beans.factory.wiring.BeanConfigurerSupport configurer) Sets the manager responsible for configuring the newly created instances.void
setDistribute
(boolean distribute) Sets the distribution of the region of thisInstantiator
during the container startup.Methods inherited from class org.apache.geode.Instantiator
getContext, getEventId, getId, getInstantiatedClass, register, register, setContext, setEventId
-
Constructor Details
-
WiringInstantiator
public WiringInstantiator(org.apache.geode.Instantiator instantiator) -
WiringInstantiator
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Throws:
org.springframework.beans.BeansException
-
newInstance
public org.apache.geode.DataSerializable newInstance()- Specified by:
newInstance
in classorg.apache.geode.Instantiator
-
setConfigurer
public void setConfigurer(org.springframework.beans.factory.wiring.BeanConfigurerSupport configurer) Sets the manager responsible for configuring the newly created instances. The given configurer needs to be configured and initialized before-hand.- Parameters:
configurer
- the configurer to set
-
setAutoRegister
public void setAutoRegister(boolean autoRegister) Sets the auto-registration of thisInstantiator
during the container startup. Default is true, meaning the registration will occur once this factory is initialized.- Parameters:
autoRegister
- the autoRegister to set- See Also:
-
Instantiator.register(Instantiator)
-
setDistribute
public void setDistribute(boolean distribute) Sets the distribution of the region of thisInstantiator
during the container startup. Default is false, meaning the registration will not be distributed to other clients.- Parameters:
distribute
- whether the registration is distributable or not- See Also:
-
Instantiator.register(Instantiator, boolean)
-