Class WiringInstantiator
java.lang.Object
org.apache.geode.Instantiator
org.springframework.data.gemfire.serialization.WiringInstantiator
- All Implemented Interfaces:
Aware,BeanFactoryAware,DisposableBean,InitializingBean
public class WiringInstantiator
extends Instantiator
implements BeanFactoryAware, InitializingBean, 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).- Author:
- Costin Leau
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionWiringInstantiator(Class<? extends DataSerializable> c, int classId) WiringInstantiator(Instantiator instantiator) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddestroy()voidsetAutoRegister(boolean autoRegister) Sets the auto-registration of thisInstantiatorduring the container startup.voidsetBeanFactory(BeanFactory beanFactory) voidsetConfigurer(BeanConfigurerSupport configurer) Sets the manager responsible for configuring the newly created instances.voidsetDistribute(boolean distribute) Sets the distribution of the region of thisInstantiatorduring the container startup.Methods inherited from class org.apache.geode.Instantiator
getContext, getEventId, getId, getInstantiatedClass, register, register, setContext, setEventId
-
Constructor Details
-
WiringInstantiator
-
WiringInstantiator
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
destroy
- Specified by:
destroyin interfaceDisposableBean- Throws:
Exception
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Throws:
BeansException
-
newInstance
- Specified by:
newInstancein classInstantiator
-
setConfigurer
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 thisInstantiatorduring the container startup. Default is true, meaning the registration will occur once this factory is initialized.- Parameters:
autoRegister- the autoRegister to set- See Also:
-
setDistribute
public void setDistribute(boolean distribute) Sets the distribution of the region of thisInstantiatorduring 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:
-