| 1 | |
package org.kuali.spring.util; |
| 2 | |
|
| 3 | |
import org.springframework.beans.BeansException; |
| 4 | |
import org.springframework.beans.factory.BeanFactory; |
| 5 | |
import org.springframework.beans.factory.BeanFactoryAware; |
| 6 | |
import org.springframework.beans.factory.BeanInitializationException; |
| 7 | |
import org.springframework.beans.factory.BeanNameAware; |
| 8 | |
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; |
| 9 | |
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; |
| 10 | |
import org.springframework.core.Ordered; |
| 11 | |
import org.springframework.core.PriorityOrdered; |
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | 1 | public abstract class PlaceholderConfigurer implements BeanNameAware, BeanFactoryAware, BeanFactoryPostProcessor, |
| 17 | |
PriorityOrdered { |
| 18 | |
|
| 19 | 1 | private int order = Ordered.LOWEST_PRECEDENCE; |
| 20 | |
|
| 21 | |
private String beanName; |
| 22 | |
private BeanFactory beanFactory; |
| 23 | |
|
| 24 | |
protected abstract void processPlaceholders(ConfigurableListableBeanFactory beanFactory); |
| 25 | |
|
| 26 | |
@Override |
| 27 | |
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { |
| 28 | |
try { |
| 29 | 1 | processPlaceholders(beanFactory); |
| 30 | 0 | } catch (Exception e) { |
| 31 | 0 | throw new BeanInitializationException("Could not complete placeholder configuration", e); |
| 32 | 1 | } |
| 33 | 1 | } |
| 34 | |
|
| 35 | |
public void setOrder(int order) { |
| 36 | 0 | this.order = order; |
| 37 | 0 | } |
| 38 | |
|
| 39 | |
public int getOrder() { |
| 40 | 0 | return this.order; |
| 41 | |
} |
| 42 | |
|
| 43 | |
public String getBeanName() { |
| 44 | 14 | return beanName; |
| 45 | |
} |
| 46 | |
|
| 47 | |
public void setBeanName(String beanName) { |
| 48 | 1 | this.beanName = beanName; |
| 49 | 1 | } |
| 50 | |
|
| 51 | |
public BeanFactory getBeanFactory() { |
| 52 | 1 | return beanFactory; |
| 53 | |
} |
| 54 | |
|
| 55 | |
public void setBeanFactory(BeanFactory beanFactory) { |
| 56 | 1 | this.beanFactory = beanFactory; |
| 57 | 1 | } |
| 58 | |
|
| 59 | |
} |