Package ome.services.util
Class BeanInstantiationGuard
- java.lang.Object
-
- ome.services.util.BeanInstantiationGuard
-
- All Implemented Interfaces:
org.springframework.beans.factory.config.BeanFactoryPostProcessor
- Direct Known Subclasses:
BeanInstantiationSubstituter
public class BeanInstantiationGuard extends java.lang.Object implements org.springframework.beans.factory.config.BeanFactoryPostProcessor
Prevents creation of Spring beans based on read-only status.- Since:
- 5.4.6
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
targetName
-
Constructor Summary
Constructors Constructor Description BeanInstantiationGuard(ReadOnlyStatus readOnly, java.lang.String targetName)
Construct a bean instantiation guard.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory factory)
protected void
setBeanDefinitionForReadOnly(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
Act on the bean definition registry to make the target bean suitable for read-only mode.void
setIsWriteDb(boolean isWriteDb)
void
setIsWriteRepo(boolean isWriteRepo)
-
-
-
Constructor Detail
-
BeanInstantiationGuard
public BeanInstantiationGuard(ReadOnlyStatus readOnly, java.lang.String targetName)
Construct a bean instantiation guard.- Parameters:
readOnly
- the read-only statustargetName
- the name of a bean that needs to write
-
-
Method Detail
-
setIsWriteDb
public void setIsWriteDb(boolean isWriteDb)
- Parameters:
isWriteDb
- if the target bean needs to write to the database, defaults tofalse
-
setIsWriteRepo
public void setIsWriteRepo(boolean isWriteRepo)
- Parameters:
isWriteRepo
- if the target bean needs to write to the repository, defaults tofalse
-
postProcessBeanFactory
public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory factory)
- Specified by:
postProcessBeanFactory
in interfaceorg.springframework.beans.factory.config.BeanFactoryPostProcessor
-
setBeanDefinitionForReadOnly
protected void setBeanDefinitionForReadOnly(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
Act on the bean definition registry to make the target bean suitable for read-only mode.- Parameters:
registry
- the bean definition registry
-
-