本文整理汇总了Java中org.springframework.beans.factory.parsing.CompositeComponentDefinition.addNestedComponent方法的典型用法代码示例。如果您正苦于以下问题:Java CompositeComponentDefinition.addNestedComponent方法的具体用法?Java CompositeComponentDefinition.addNestedComponent怎么用?Java CompositeComponentDefinition.addNestedComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.factory.parsing.CompositeComponentDefinition
的用法示例。
在下文中一共展示了CompositeComponentDefinition.addNestedComponent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerComponents
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
protected void registerComponents(
XmlReaderContext readerContext, Set<BeanDefinitionHolder> beanDefinitions, Element element) {
Object source = readerContext.extractSource(element);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), source);
for (BeanDefinitionHolder beanDefHolder : beanDefinitions) {
compositeDef.addNestedComponent(new BeanComponentDefinition(beanDefHolder));
}
// Register annotation config processors, if necessary.
boolean annotationConfig = true;
if (element.hasAttribute(ANNOTATION_CONFIG_ATTRIBUTE)) {
annotationConfig = Boolean.valueOf(element.getAttribute(ANNOTATION_CONFIG_ATTRIBUTE));
}
if (annotationConfig) {
Set<BeanDefinitionHolder> processorDefinitions =
AnnotationConfigUtils.registerAnnotationConfigProcessors(readerContext.getRegistry(), source);
for (BeanDefinitionHolder processorDefinition : processorDefinitions) {
compositeDef.addNestedComponent(new BeanComponentDefinition(processorDefinition));
}
}
readerContext.fireComponentRegistered(compositeDef);
}
示例2: doParse
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
private synchronized void doParse(Element element, ParserContext parserContext) {
String[] basePackages = StringUtils.tokenizeToStringArray(element.getAttribute("base-package"), ",; \t\n");
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
if (!parserContext.getRegistry().containsBeanDefinition(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME)) {
Object eleSource = parserContext.extractSource(element);
RootBeanDefinition configMapDef = new RootBeanDefinition(ConcurrentHashMap.class);
configMapDef.setSource(eleSource);
configMapDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
String configMapName = parserContext.getReaderContext().registerWithGeneratedName(configMapDef);
RootBeanDefinition interceptorDef = new RootBeanDefinition(JetCacheInterceptor.class);
interceptorDef.setSource(eleSource);
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
interceptorDef.getPropertyValues().addPropertyValue(new PropertyValue("cacheConfigMap", new RuntimeBeanReference(configMapName)));
String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);
RootBeanDefinition advisorDef = new RootBeanDefinition(CacheAdvisor.class);
advisorDef.setSource(eleSource);
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("adviceBeanName", interceptorName));
advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("cacheConfigMap", new RuntimeBeanReference(configMapName)));
advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("basePackages", basePackages));
parserContext.getRegistry().registerBeanDefinition(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME, advisorDef);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(),
eleSource);
compositeDef.addNestedComponent(new BeanComponentDefinition(configMapDef, configMapName));
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheAdvisor.CACHE_ADVISOR_BEAN_NAME));
parserContext.registerComponent(compositeDef);
}
}
示例3: registerComponents
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
protected void registerComponents(
XmlReaderContext readerContext, Set<BeanDefinitionHolder> beanDefinitions, Element element) {
Object source = readerContext.extractSource(element);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), source);
for (BeanDefinitionHolder beanDefHolder : beanDefinitions) {
compositeDef.addNestedComponent(new BeanComponentDefinition(beanDefHolder));
}
// Register annotation config processors, if necessary.
Set<BeanDefinitionHolder> processorDefinitions =
AnnotationConfigUtils.registerAnnotationConfigProcessors(readerContext.getRegistry(), source);
for (BeanDefinitionHolder processorDefinition : processorDefinitions) {
compositeDef.addNestedComponent(new BeanComponentDefinition(processorDefinition));
}
readerContext.fireComponentRegistered(compositeDef);
}
示例4: configureAutoProxyCreator
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
public static void configureAutoProxyCreator(Element element, ParserContext parserContext) {
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
if (!parserContext.getRegistry().containsBeanDefinition(CACHE_ADVISOR_BEAN_NAME)) {
Object eleSource = parserContext.extractSource(element);
// Create the CacheOperationSource definition.
RootBeanDefinition sourceDef = new RootBeanDefinition(AnnotationCacheOperationSource.class);
sourceDef.setSource(eleSource);
sourceDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);
// Create the CacheInterceptor definition.
RootBeanDefinition interceptorDef = new RootBeanDefinition(CacheInterceptor.class);
interceptorDef.setSource(eleSource);
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
parseCacheManagerProperty(element, interceptorDef);
CacheNamespaceHandler.parseKeyGenerator(element, interceptorDef);
interceptorDef.getPropertyValues().add("cacheOperationSources", new RuntimeBeanReference(sourceName));
String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);
// Create the CacheAdvisor definition.
RootBeanDefinition advisorDef = new RootBeanDefinition(BeanFactoryCacheOperationSourceAdvisor.class);
advisorDef.setSource(eleSource);
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
advisorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
if (element.hasAttribute("order")) {
advisorDef.getPropertyValues().add("order", element.getAttribute("order"));
}
parserContext.getRegistry().registerBeanDefinition(CACHE_ADVISOR_BEAN_NAME, advisorDef);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(),
eleSource);
compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName));
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CACHE_ADVISOR_BEAN_NAME));
parserContext.registerComponent(compositeDef);
}
}
示例5: parse
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
@Override
public BeanDefinition parse( Element element, ParserContext parserContext ) {
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary( parserContext, element );
if( !parserContext.getRegistry().containsBeanDefinition( BEAN_NAME ) ) {
Object eleSource = parserContext.extractSource( element );
RootBeanDefinition stageCreator = new RootBeanDefinition( SpringStageCreator.class );
stageCreator.setSource( eleSource );
stageCreator.setRole( BeanDefinition.ROLE_INFRASTRUCTURE );
String executorName = parserContext.getReaderContext().registerWithGeneratedName( stageCreator );
logger.debug( "Registered SpringStageCreator with name " + executorName );
RootBeanDefinition beanFactoryPostProcessor = new RootBeanDefinition( JGivenBeanFactoryPostProcessor.class );
beanFactoryPostProcessor.setRole( BeanDefinition.ROLE_INFRASTRUCTURE );
parserContext.getRegistry().registerBeanDefinition( BEAN_NAME, beanFactoryPostProcessor );
CompositeComponentDefinition componentDefinition = new CompositeComponentDefinition( element.getTagName(), eleSource );
componentDefinition.addNestedComponent( new BeanComponentDefinition( stageCreator, executorName ) );
componentDefinition.addNestedComponent( new BeanComponentDefinition( beanFactoryPostProcessor, BEAN_NAME ) );
parserContext.registerComponent( componentDefinition );
}
return null;
}
示例6: parse
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public BeanDefinition parse(Element element, ParserContext parserContext) {
Object source = parserContext.extractSource(element);
CompositeComponentDefinition ccd = new CompositeComponentDefinition("jdal-swing", source);
ccd.addNestedComponent(registerPropertyEditors(element, parserContext));
ccd.addNestedComponent(registerAccessorFactory(element, parserContext));
ccd.addNestedComponent(registerBinderFactory(element, parserContext));
ccd.addNestedComponent(registerPaginatorView(element, parserContext));
ccd.addNestedComponent(registerDefaultTableActions(element, parserContext));
ccd.addNestedComponent(registerDefaultGuiFactory(element, parserContext));
ccd.addNestedComponent(registerCollectionTableCellRenderer(element, parserContext));
// ccd.addNestedComponent(registerControlInitializer(element, parserContext));
parserContext.getReaderContext().fireComponentRegistered(ccd);
return null;
}
示例7: configureAutoProxyCreator
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
public static void configureAutoProxyCreator(Element element, ParserContext parserContext) {
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
String txAdvisorBeanName = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME;
if (!parserContext.getRegistry().containsBeanDefinition(txAdvisorBeanName)) {
Object eleSource = parserContext.extractSource(element);
// Create the TransactionAttributeSource definition.
RootBeanDefinition sourceDef = new RootBeanDefinition(
"org.springframework.transaction.annotation.AnnotationTransactionAttributeSource");
sourceDef.setSource(eleSource);
sourceDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);
// Create the TransactionInterceptor definition.
RootBeanDefinition interceptorDef = new RootBeanDefinition(TransactionInterceptor.class);
interceptorDef.setSource(eleSource);
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
registerTransactionManager(element, interceptorDef);
interceptorDef.getPropertyValues().add("transactionAttributeSource", new RuntimeBeanReference(sourceName));
String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);
// Create the TransactionAttributeSourceAdvisor definition.
RootBeanDefinition advisorDef = new RootBeanDefinition(BeanFactoryTransactionAttributeSourceAdvisor.class);
advisorDef.setSource(eleSource);
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
advisorDef.getPropertyValues().add("transactionAttributeSource", new RuntimeBeanReference(sourceName));
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
if (element.hasAttribute("order")) {
advisorDef.getPropertyValues().add("order", element.getAttribute("order"));
}
parserContext.getRegistry().registerBeanDefinition(txAdvisorBeanName, advisorDef);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource);
compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName));
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, txAdvisorBeanName));
parserContext.registerComponent(compositeDef);
}
}
示例8: registerComponent
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
public void registerComponent(ComponentDefinition component) {
CompositeComponentDefinition containingComponent = getContainingComponent();
if (containingComponent != null) {
containingComponent.addNestedComponent(component);
}
else {
this.readerContext.fireComponentRegistered(component);
}
}
示例9: registerCacheAdvisor
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
private static void registerCacheAdvisor(Element element, ParserContext parserContext) {
if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME)) {
Object eleSource = parserContext.extractSource(element);
// Create the CacheOperationSource definition.
RootBeanDefinition sourceDef = new RootBeanDefinition("org.springframework.cache.annotation.AnnotationCacheOperationSource");
sourceDef.setSource(eleSource);
sourceDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);
// Create the CacheInterceptor definition.
RootBeanDefinition interceptorDef = new RootBeanDefinition(CacheInterceptor.class);
interceptorDef.setSource(eleSource);
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
parseCacheResolution(element, interceptorDef, false);
parseErrorHandler(element, interceptorDef);
CacheNamespaceHandler.parseKeyGenerator(element, interceptorDef);
interceptorDef.getPropertyValues().add("cacheOperationSources", new RuntimeBeanReference(sourceName));
String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);
// Create the CacheAdvisor definition.
RootBeanDefinition advisorDef = new RootBeanDefinition(BeanFactoryCacheOperationSourceAdvisor.class);
advisorDef.setSource(eleSource);
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
advisorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
if (element.hasAttribute("order")) {
advisorDef.getPropertyValues().add("order", element.getAttribute("order"));
}
parserContext.getRegistry().registerBeanDefinition(CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME, advisorDef);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource);
compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName));
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME));
parserContext.registerComponent(compositeDef);
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:39,代码来源:AnnotationDrivenCacheBeanDefinitionParser.java
示例10: configureAutoProxyCreator
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
public static void configureAutoProxyCreator(Element element, ParserContext parserContext) {
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
String txAdvisorBeanName = Constants.TRANSACTION_ADVISOR_BEAN_NAME;
if (!parserContext.getRegistry().containsBeanDefinition(txAdvisorBeanName)) {
LdtmSpringUtils.init(parserContext, element);
Object eleSource = parserContext.extractSource(element);
// Create the TransactionAttributeSource definition.
RootBeanDefinition sourceDef = new RootBeanDefinition(AnnotationLdtmAttributeSource.class);
sourceDef.setSource(eleSource);
sourceDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);
// Create the TransactionInterceptor definition.
RootBeanDefinition interceptorDef = new RootBeanDefinition(TransactionInterceptor.class);
interceptorDef.setSource(eleSource);
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
registerTransactionManager(element, interceptorDef);
interceptorDef.getPropertyValues().add("transactionAttributeSource", new RuntimeBeanReference(sourceName));
interceptorDef.getPropertyValues().add("ldtmTransactionHelper", new RuntimeBeanReference(Constants.TRANSACTION_HELPER_BEAN_NAME));
String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);
// Create the TransactionAttributeSourceAdvisor definition.
RootBeanDefinition advisorDef = new RootBeanDefinition(BeanFactoryTransactionAttributeSourceAdvisor.class);
advisorDef.setSource(eleSource);
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
advisorDef.getPropertyValues().add("transactionAttributeSource", new RuntimeBeanReference(sourceName));
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
advisorDef.getPropertyValues().add("order", Ordered.HIGHEST_PRECEDENCE);
parserContext.getRegistry().registerBeanDefinition(txAdvisorBeanName, advisorDef);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource);
compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName));
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, txAdvisorBeanName));
parserContext.registerComponent(compositeDef);
}
}
示例11: parse
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
AopNamespaceUtils.registerAspectJAutoProxyCreatorIfNecessary(parserContext, element);
Object eleSource = parserContext.extractSource(element);
RootBeanDefinition interceptorSupportDef = new RootBeanDefinition(DefaultValidatorInterceptorSupport.class);
interceptorSupportDef.setSource(eleSource);
interceptorSupportDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
parserContext.getReaderContext().registerWithGeneratedName(interceptorSupportDef);
Class<? extends ConstraintViolationHandler> constraintViolationHandlerClazz = getConstraintViolationHandlerClazz(element);
RootBeanDefinition violationHandlerDef = new RootBeanDefinition(constraintViolationHandlerClazz);
violationHandlerDef.setSource(eleSource);
violationHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
parserContext.getReaderContext().registerWithGeneratedName(violationHandlerDef);
RootBeanDefinition interceptorDef = new RootBeanDefinition(ValidationInterceptor.class);
interceptorDef.setSource(eleSource);
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
interceptorDef.getPropertyValues().add("validatorInterceptorSupport", interceptorSupportDef);
interceptorDef.getPropertyValues().add("constraintViolationHandler", violationHandlerDef);
String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);
RootBeanDefinition advisorDef = new RootBeanDefinition(BeanFactoryAnnotatedValidationPointcutAdvisor.class);
advisorDef.setSource(eleSource);
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
String validationAdvisorBeanName = parserContext.getReaderContext().registerWithGeneratedName(advisorDef);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource);
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, validationAdvisorBeanName));
parserContext.registerComponent(compositeDef);
registerValidatorBeans(eleSource, parserContext);
return null;
}
示例12: parse
import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public BeanDefinition parse(Element element, ParserContext parserContext) {
Object source = parserContext.extractSource(element);
CompositeComponentDefinition ccd = new CompositeComponentDefinition("jdal-vaadin", source);
ccd.addNestedComponent(registerPropertyEditors(element, parserContext));
ccd.addNestedComponent(registerPaginatorView(element, parserContext));
ccd.addNestedComponent(registerDefaultTableActions(element, parserContext));
ccd.addNestedComponent(registerDefaultGuiFactory(element, parserContext));
parserContext.getReaderContext().fireComponentRegistered(ccd);
return null;
}