public class LifecycleBeanPostProcessor extends Object implements org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor, org.springframework.core.PriorityOrdered
Bean post processor for Spring that automatically calls the init() and/or
destroy() methods on Shiro objects that implement the Initializable
or Destroyable interfaces, respectfully. This post processor makes it easier
to configure Shiro beans in Spring, since the user never has to worry about whether or not if they
have to specify init-method and destroy-method bean attributes.
Warning: This post processor has no way to determine if init() or destroy() have already been called, so if you define this post processor in your applicationContext, do not also call these methods manually or via Spring's init-method or destroy-method bean attributes.
| Constructor and Description |
|---|
LifecycleBeanPostProcessor()
Default Constructor.
|
LifecycleBeanPostProcessor(int order)
Constructor with definable
order value. |
| Modifier and Type | Method and Description |
|---|---|
int |
getOrder()
Order value of this BeanPostProcessor.
|
Object |
postProcessAfterInitialization(Object object,
String name)
Does nothing - merely returns the object argument immediately.
|
void |
postProcessBeforeDestruction(Object object,
String name)
Calls the destroy() methods on the bean if it implements
Destroyable |
Object |
postProcessBeforeInitialization(Object object,
String name)
Calls the init() methods on the bean if it implements
Initializable |
boolean |
requiresDestruction(Object bean)
Return true only if
bean implements Destroyable. |
public LifecycleBeanPostProcessor()
public LifecycleBeanPostProcessor(int order)
order value.order - order value of this BeanPostProcessor.public Object postProcessBeforeInitialization(Object object, String name) throws org.springframework.beans.BeansException
InitializablepostProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessorobject - the object being initialized.name - the name of the bean being initialized.org.springframework.beans.BeansException - if any exception is thrown during initialization.public Object postProcessAfterInitialization(Object object, String name) throws org.springframework.beans.BeansException
postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessororg.springframework.beans.BeansExceptionpublic void postProcessBeforeDestruction(Object object, String name) throws org.springframework.beans.BeansException
DestroyablepostProcessBeforeDestruction in interface org.springframework.beans.factory.config.DestructionAwareBeanPostProcessorobject - the object being initialized.name - the name of the bean being initialized.org.springframework.beans.BeansException - if any exception is thrown during initialization.public int getOrder()
getOrder in interface org.springframework.core.Orderedpublic boolean requiresDestruction(Object bean)
bean implements Destroyable.requiresDestruction in interface org.springframework.beans.factory.config.DestructionAwareBeanPostProcessorbean - bean to check if requires destruction.bean implements Destroyable.Copyright © 2004–2020 The Apache Software Foundation. All rights reserved.