Java Code Examples for org.springframework.beans.factory.support.AbstractBeanDefinition#setRole()
The following examples show how to use
org.springframework.beans.factory.support.AbstractBeanDefinition#setRole() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnnotationConfigUtils.java From lams with GNU General Public License v2.0 | 6 votes |
static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd, AnnotatedTypeMetadata metadata) { if (metadata.isAnnotated(Lazy.class.getName())) { abd.setLazyInit(attributesFor(metadata, Lazy.class).getBoolean("value")); } else if (abd.getMetadata() != metadata && abd.getMetadata().isAnnotated(Lazy.class.getName())) { abd.setLazyInit(attributesFor(abd.getMetadata(), Lazy.class).getBoolean("value")); } if (metadata.isAnnotated(Primary.class.getName())) { abd.setPrimary(true); } if (metadata.isAnnotated(DependsOn.class.getName())) { abd.setDependsOn(attributesFor(metadata, DependsOn.class).getStringArray("value")); } if (abd instanceof AbstractBeanDefinition) { AbstractBeanDefinition absBd = (AbstractBeanDefinition) abd; if (metadata.isAnnotated(Role.class.getName())) { absBd.setRole(attributesFor(metadata, Role.class).getNumber("value").intValue()); } if (metadata.isAnnotated(Description.class.getName())) { absBd.setDescription(attributesFor(metadata, Description.class).getString("value")); } } }
Example 2
Source File: AnnotationConfigUtils.java From spring4-understanding with Apache License 2.0 | 6 votes |
static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd, AnnotatedTypeMetadata metadata) { if (metadata.isAnnotated(Lazy.class.getName())) { abd.setLazyInit(attributesFor(metadata, Lazy.class).getBoolean("value")); } else if (abd.getMetadata() != metadata && abd.getMetadata().isAnnotated(Lazy.class.getName())) { abd.setLazyInit(attributesFor(abd.getMetadata(), Lazy.class).getBoolean("value")); } if (metadata.isAnnotated(Primary.class.getName())) { abd.setPrimary(true); } if (metadata.isAnnotated(DependsOn.class.getName())) { abd.setDependsOn(attributesFor(metadata, DependsOn.class).getStringArray("value")); } if (abd instanceof AbstractBeanDefinition) { AbstractBeanDefinition absBd = (AbstractBeanDefinition) abd; if (metadata.isAnnotated(Role.class.getName())) { absBd.setRole(attributesFor(metadata, Role.class).getNumber("value").intValue()); } if (metadata.isAnnotated(Description.class.getName())) { absBd.setDescription(attributesFor(metadata, Description.class).getString("value")); } } }
Example 3
Source File: AuditingBeanDefinitionParser.java From spring-data-mybatis with Apache License 2.0 | 5 votes |
private void registerInfrastructureBeanWithId(AbstractBeanDefinition def, String id, ParserContext context, Element element) { def.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); def.setSource(context.extractSource(element)); context.registerBeanComponent(new BeanComponentDefinition(def, id)); }
Example 4
Source File: ActivitiAnnotationDrivenBeanDefinitionParser.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
private void registerProcessScope(Element element, ParserContext parserContext) { Class clz = ProcessScope.class; BeanDefinitionBuilder processScopeBDBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz); AbstractBeanDefinition scopeBeanDefinition = processScopeBDBuilder.getBeanDefinition(); scopeBeanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); configureProcessEngine(scopeBeanDefinition, element); String beanName = baseBeanName(clz); parserContext.getRegistry().registerBeanDefinition(beanName, scopeBeanDefinition); }
Example 5
Source File: ActivitiAnnotationDrivenBeanDefinitionParser.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
private void registerProcessStartAnnotationBeanPostProcessor(Element element, ParserContext parserContext) { Class clz = ProcessStartAnnotationBeanPostProcessor.class; BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz); AbstractBeanDefinition beanDefinition = beanDefinitionBuilder.getBeanDefinition(); beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); configureProcessEngine(beanDefinition, element); String beanName = baseBeanName(clz); parserContext.getRegistry().registerBeanDefinition(beanName, beanDefinition); }
Example 6
Source File: DubboConfigBindingRegistrar.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
private void registerDubboConfigBindingBeanPostProcessor(String prefix, String beanName, boolean multiple, BeanDefinitionRegistry registry) { // 对dubbo配置bean实例化过程进行干预 Class<?> processorClass = DubboConfigBindingBeanPostProcessor.class; BeanDefinitionBuilder builder = rootBeanDefinition(processorClass); String actualPrefix = multiple ? normalizePrefix(prefix) + beanName : prefix; builder.addConstructorArgValue(actualPrefix).addConstructorArgValue(beanName); AbstractBeanDefinition beanDefinition = builder.getBeanDefinition(); beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); registerWithGeneratedName(beanDefinition, registry); if (log.isInfoEnabled()) { log.info("The BeanPostProcessor bean definition [" + processorClass.getName() + "] for dubbo config bean [name : " + beanName + "] has been registered."); } }