use of com.revolsys.spring.util.PlaceholderResolvingStringValueResolver in project com.revolsys.open by revolsys.
the class BeanConfigurrer method processPlaceholderAttributes.
protected void processPlaceholderAttributes(final ConfigurableListableBeanFactory beanFactory, final String beanName, final Map<String, Object> attributes) throws BeansException {
final StringValueResolver valueResolver = new PlaceholderResolvingStringValueResolver("${", "}", this.ignoreUnresolvablePlaceholders, null, attributes);
final BeanDefinitionVisitor visitor = new BeanDefinitionVisitor(valueResolver);
// locations.
if (!(beanName.equals(this.beanName) && beanFactory.equals(this.applicationContext))) {
final BeanDefinition bd = beanFactory.getBeanDefinition(beanName);
try {
visitor.visitBeanDefinition(bd);
} catch (final BeanDefinitionStoreException ex) {
throw new BeanDefinitionStoreException(bd.getResourceDescription(), beanName, ex.getMessage());
}
}
// NEW in Spring 2.5: resolve placeholders in alias target names and aliases
// as well.
beanFactory.resolveAliases(valueResolver);
}
use of com.revolsys.spring.util.PlaceholderResolvingStringValueResolver in project com.revolsys.open by revolsys.
the class BeanConfigurrer method processPlaceholderAttributes.
protected void processPlaceholderAttributes(final ConfigurableListableBeanFactory beanFactory, final Map<String, Object> attributes) throws BeansException {
final Map<String, Object> attributeMap = new LinkedHashMap<>();
for (final Entry<String, Object> entry : attributes.entrySet()) {
final String key = entry.getKey();
final Object value = entry.getValue();
if (!(value instanceof BeanReference)) {
attributeMap.put(key, value);
}
}
final StringValueResolver valueResolver = new PlaceholderResolvingStringValueResolver("${", "}", this.ignoreUnresolvablePlaceholders, null, attributeMap);
final BeanDefinitionVisitor visitor = new BeanDefinitionVisitor(valueResolver);
final String[] beanNames = beanFactory.getBeanDefinitionNames();
for (int i = 0; i < beanNames.length; i++) {
// locations.
if (!(beanNames[i].equals(this.beanName) && beanFactory.equals(this.applicationContext))) {
final BeanDefinition bd = beanFactory.getBeanDefinition(beanNames[i]);
try {
visitor.visitBeanDefinition(bd);
} catch (final BeanDefinitionStoreException ex) {
throw new BeanDefinitionStoreException(bd.getResourceDescription(), beanNames[i], ex.getMessage());
}
}
}
// NEW in Spring 2.5: resolve placeholders in alias target names and aliases
// as well.
beanFactory.resolveAliases(valueResolver);
}
Aggregations