org.dellroad.stuff.schema
Class AbstractSpringSchemaUpdate<T>
java.lang.Object
org.dellroad.stuff.schema.AbstractSchemaUpdate<T>
org.dellroad.stuff.schema.AbstractSpringSchemaUpdate<T>
- Type Parameters:
T - database transaction type
- All Implemented Interfaces:
- SchemaUpdate<T>, BeanFactoryAware, BeanNameAware, InitializingBean
- Direct Known Subclasses:
- SpringPersistentObjectSchemaUpdate, SpringSQLSchemaUpdate
public abstract class AbstractSpringSchemaUpdate<T>
- extends AbstractSchemaUpdate<T>
- implements BeanNameAware, BeanFactoryAware, InitializingBean
Support superclass for SchemaUpdates declared in Spring BeanFactorys that infer their
names and required predecessors from their Spring bean attributes.
Instances infer their name and required predecessors from
their Spring bean name (specified by the id XML attribute) and Spring dependencies (specified by
the depends-on XML attribute), respectively.
Note: the use of depends-on is an abuse of Spring's dependency notation for convenience. Normally
depends-on refers to bean intialization ordering, whereas this class uses it to refer to schema update ordering.
Schema updates are not normally expected to have any initialization ordering requirements, so this abuse shouldn't matter.
If they do, this class should not be used.
The containing BeanFactory must be a ConfigurableBeanFactory (normally this is always the case).
beanName
protected String beanName
beanFactory
protected BeanFactory beanFactory
AbstractSpringSchemaUpdate
public AbstractSpringSchemaUpdate()
setBeanName
public void setBeanName(String beanName)
- Specified by:
setBeanName in interface BeanNameAware
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
- Specified by:
setBeanFactory in interface BeanFactoryAware
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- Configures the update name and required predecessors based on the Spring bean's name and
BeanFactory dependencies.
- Specified by:
afterPropertiesSet in interface InitializingBean
- Throws:
Exception
setRequiredPredecessorsFromDependencies
protected void setRequiredPredecessorsFromDependencies()
- Infer required predecessors from Spring dependencies.
- Throws:
IllegalArgumentException - if this instance's beanFactory is not yet configured,
or not a ConfigurableBeanFactory