use of org.springframework.beans.factory.config.BeanDefinition in project joinfaces by joinfaces.
the class CustomScopeAnnotationConfigurer method postProcessBeanFactory.
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory clbf) throws BeansException {
for (String beanName : clbf.getBeanDefinitionNames()) {
BeanDefinition definition = clbf.getBeanDefinition(beanName);
registerJsfCdiToSpring(definition);
}
}
use of org.springframework.beans.factory.config.BeanDefinition in project commons by terran4j.
the class DsqlRepositoryConfigRegistrar method registBean.
final void registBean(DefaultListableBeanFactory registry, Class<?> daoClass) {
if (log.isInfoEnabled()) {
log.info("regist DsqlRepository: {}", daoClass);
}
BeanDefinition annotationProcessor = BeanDefinitionBuilder.genericBeanDefinition(daoClass).getBeanDefinition();
String beanName = beanNameGenerator.generateBeanName(annotationProcessor, registry);
registerBeanDefinitionIfNotExists(registry, beanName, daoClass);
}
use of org.springframework.beans.factory.config.BeanDefinition in project commons by terran4j.
the class DsqlRepositoryConfigRegistrar method registerBeanDefinitionIfNotExists.
boolean registerBeanDefinitionIfNotExists(DefaultListableBeanFactory registry, String beanName, Class<?> beanClass) {
if (registry.containsBeanDefinition(beanName)) {
return false;
}
String[] candidates = registry.getBeanDefinitionNames();
for (String candidate : candidates) {
BeanDefinition beanDefinition = registry.getBeanDefinition(candidate);
if (Objects.equals(beanDefinition.getBeanClassName(), beanClass.getName())) {
return false;
}
}
Object bean = DsqlRepositoryProxy.createProxyObject(beanClass);
registry.registerSingleton(beanName, bean);
return true;
}
use of org.springframework.beans.factory.config.BeanDefinition in project tephra by heisedebaise.
the class ClassReloaderImpl method load.
private void load(ClassLoader loader, String name) {
try {
DefaultListableBeanFactory lbf = (DefaultListableBeanFactory) applicationContext.getAutowireCapableBeanFactory();
BeanDefinition bd = BeanDefinitionReaderUtils.createBeanDefinition(null, name, loader);
String dynamicBeanName = generator.uuid();
lbf.registerBeanDefinition(dynamicBeanName, bd);
Object bean = lbf.getBean(dynamicBeanName);
String beanName = getBeanName(bean.getClass());
Object oldBean = null;
if (beanName != null) {
oldBean = container.getBean(beanName);
container.mapBeanName(beanName, dynamicBeanName);
}
inject(bean.getClass(), null, bean);
inject(bean, oldBean);
} catch (Exception e) {
logger.warn(e, "重新载入[{}]时发生异常!", name);
}
}
use of org.springframework.beans.factory.config.BeanDefinition in project spring-integration by spring-projects.
the class ExpressionEvaluatingMessageProcessorTests method testProcessMessageWithMethodCallOnBean.
@Test
public void testProcessMessageWithMethodCallOnBean() throws Exception {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinition beanDefinition = new RootBeanDefinition(String.class);
beanDefinition.getConstructorArgumentValues().addGenericArgumentValue("bar");
context.registerBeanDefinition(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME, new RootBeanDefinition(IntegrationEvaluationContextFactoryBean.class));
context.registerBeanDefinition("testString", beanDefinition);
context.refresh();
Expression expression = expressionParser.parseExpression("@testString.concat(payload)");
ExpressionEvaluatingMessageProcessor<String> processor = new ExpressionEvaluatingMessageProcessor<>(expression);
processor.setBeanFactory(context);
processor.afterPropertiesSet();
GenericMessage<String> message = new GenericMessage<>("foo");
assertEquals("barfoo", processor.processMessage(message));
}
Aggregations