Package org.apache.camel.spi
Interface CamelBeanPostProcessor
public interface CamelBeanPostProcessor
Bean post processor.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidAdds a custom bean post injectorCustom strategy for handlingBindToRegistrybeans and whether they are lazy or not.default booleandefault booleanCan be used to unbind any existing beans before binding a bean to the registry.default ObjectpostProcessAfterInitialization(Object bean, String beanName) Apply this post processor to the given new bean instance after any bean initialization callbacks (likeafterPropertiesSetor a custom init-method).default ObjectpostProcessBeforeInitialization(Object bean, String beanName) Apply this post processor to the given new bean instance before any bean initialization callbacks (likeafterPropertiesSetor a custom init-method).default voidsetEnabled(boolean enabled) Can be used to turn off bean post processing.voidsetLazyBeanStrategy(Predicate<BindToRegistry> strategy) Custom strategy for handlingBindToRegistrybeans and whether they are lazy or not.default voidsetUnbindEnabled(boolean unbindEnabled)
-
Method Details
-
postProcessBeforeInitialization
Apply this post processor to the given new bean instance before any bean initialization callbacks (likeafterPropertiesSetor a custom init-method). The bean will already be populated with property values. The returned bean instance may be a wrapper around the original.- Parameters:
bean- the new bean instancebeanName- the name of the bean- Returns:
- the bean instance to use, either the original or a wrapped one; if
null, no subsequent BeanPostProcessors will be invoked - Throws:
Exception- is thrown if error post processing bean
-
postProcessAfterInitialization
Apply this post processor to the given new bean instance after any bean initialization callbacks (likeafterPropertiesSetor a custom init-method). The bean will already be populated with property values. The returned bean instance may be a wrapper around the original.- Parameters:
bean- the new bean instancebeanName- the name of the bean- Returns:
- the bean instance to use, either the original or a wrapped one; if
null, no subsequent BeanPostProcessors will be invoked - Throws:
Exception- is thrown if error post processing bean
-
setEnabled
default void setEnabled(boolean enabled) Can be used to turn off bean post processing. Be careful to turn this off, as this means that beans that use Camel annotations such asEndpointInject,ProducerTemplate,Produce,Consumeetc will not be injected and in use. Turning this off should only be done if you are sure you do not use any of these Camel features. -
isEnabled
default boolean isEnabled() -
setUnbindEnabled
default void setUnbindEnabled(boolean unbindEnabled) -
isUnbindEnabled
default boolean isUnbindEnabled()Can be used to unbind any existing beans before binding a bean to the registry. Be careful to enable this, as this will unbind all beans with the given id. This is used in special use-cases such as reloading of Camel routes which triggered updating beans that have their implementation re-compiled and re-loaded. -
addCamelBeanPostProjectInjector
Adds a custom bean post injector- Parameters:
injector- the custom injector
-
setLazyBeanStrategy
Custom strategy for handlingBindToRegistrybeans and whether they are lazy or not. -
getLazyBeanStrategy
Predicate<BindToRegistry> getLazyBeanStrategy()Custom strategy for handlingBindToRegistrybeans and whether they are lazy or not.
-