org.springframework.beans.factory.support.BeanDefinitionRegistry Java Examples
The following examples show how to use
org.springframework.beans.factory.support.BeanDefinitionRegistry.
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: StatefulFactory.java From statefulj with Apache License 2.0 | 6 votes |
/** * @param bf * @param reg * @param clazz * @return * @throws ClassNotFoundException */ private Class<?> getClassFromFactoryMethod(BeanDefinition bf, BeanDefinitionRegistry reg) throws ClassNotFoundException { Class<?> clazz = null; String factoryBeanName = bf.getFactoryBeanName(); if (factoryBeanName != null) { BeanDefinition factory = reg.getBeanDefinition(factoryBeanName); if (factory != null) { String factoryClassName = factory.getBeanClassName(); Class<?> factoryClass = Class.forName(factoryClassName); List<Method> methods = new LinkedList<Method>(); methods.addAll(Arrays.asList(factoryClass.getMethods())); methods.addAll(Arrays.asList(factoryClass.getDeclaredMethods())); for (Method method : methods) { method.setAccessible(true); if (method.getName().equals(bf.getFactoryMethodName())) { clazz = method.getReturnType(); break; } } } } return clazz; }
Example #2
Source File: AnnotationBean.java From dubbox with Apache License 2.0 | 6 votes |
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { if (annotationPackage == null || annotationPackage.length() == 0) { return; } if (beanFactory instanceof BeanDefinitionRegistry) { try { // init scanner Class<?> scannerClass = ReflectUtils.forName("org.springframework.context.annotation.ClassPathBeanDefinitionScanner"); Object scanner = scannerClass.getConstructor(new Class<?>[] {BeanDefinitionRegistry.class, boolean.class}).newInstance(new Object[] {(BeanDefinitionRegistry) beanFactory, true}); // add filter Class<?> filterClass = ReflectUtils.forName("org.springframework.core.type.filter.AnnotationTypeFilter"); Object filter = filterClass.getConstructor(Class.class).newInstance(Service.class); Method addIncludeFilter = scannerClass.getMethod("addIncludeFilter", ReflectUtils.forName("org.springframework.core.type.filter.TypeFilter")); addIncludeFilter.invoke(scanner, filter); // scan packages String[] packages = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage); Method scan = scannerClass.getMethod("scan", new Class<?>[]{String[].class}); scan.invoke(scanner, new Object[] {packages}); } catch (Throwable e) { // spring 2.0 } } }
Example #3
Source File: AnnotationBean.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { if (annotationPackage == null || annotationPackage.length() == 0) { return; } if (beanFactory instanceof BeanDefinitionRegistry) { try { // init scanner Class<?> scannerClass = ReflectUtils.forName("org.springframework.context.annotation.ClassPathBeanDefinitionScanner"); Object scanner = scannerClass.getConstructor(new Class<?>[]{BeanDefinitionRegistry.class, boolean.class}).newInstance(new Object[]{(BeanDefinitionRegistry) beanFactory, true}); // add filter Class<?> filterClass = ReflectUtils.forName("org.springframework.core.type.filter.AnnotationTypeFilter"); Object filter = filterClass.getConstructor(Class.class).newInstance(Service.class); Method addIncludeFilter = scannerClass.getMethod("addIncludeFilter", ReflectUtils.forName("org.springframework.core.type.filter.TypeFilter")); addIncludeFilter.invoke(scanner, filter); // scan packages String[] packages = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage); Method scan = scannerClass.getMethod("scan", new Class<?>[]{String[].class}); scan.invoke(scanner, new Object[]{packages}); } catch (Throwable e) { // spring 2.0 } } }
Example #4
Source File: MapperScannerConfigurer.java From Mapper with MIT License | 6 votes |
/** * {@inheritDoc} * * @since 1.0.2 */ @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) { if (this.processPropertyPlaceHolders) { processPropertyPlaceHolders(); } ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); scanner.setAddToConfig(this.addToConfig); scanner.setAnnotationClass(this.annotationClass); scanner.setMarkerInterface(this.markerInterface); scanner.setSqlSessionFactory(this.sqlSessionFactory); scanner.setSqlSessionTemplate(this.sqlSessionTemplate); scanner.setSqlSessionFactoryBeanName(this.sqlSessionFactoryBeanName); scanner.setSqlSessionTemplateBeanName(this.sqlSessionTemplateBeanName); scanner.setResourceLoader(this.applicationContext); scanner.setBeanNameGenerator(this.nameGenerator); scanner.registerFilters(); //设置通用 Mapper scanner.setMapperHelper(this.mapperHelper); scanner.scan(StringUtils.tokenizeToStringArray(this.basePackage, ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS)); }
Example #5
Source File: ProfileXmlBeanDefinitionTests.java From java-technology-stack with MIT License | 6 votes |
private static Matcher<BeanDefinitionRegistry> containsBeanDefinition(final String beanName) { return new TypeSafeMatcher<BeanDefinitionRegistry>() { @Override public void describeTo(Description desc) { desc.appendText("a BeanDefinitionRegistry containing bean named ") .appendValue(beanName); } @Override public boolean matchesSafely(BeanDefinitionRegistry beanFactory) { return beanFactory.containsBeanDefinition(beanName); } }; }
Example #6
Source File: NodeBeanRegistrationStrategy.java From eventeum with Apache License 2.0 | 6 votes |
private String registerNodeServicesBean(Node node, Web3j web3j, String web3jServiceBeanName, BeanDefinitionRegistry registry) { final BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( NodeServices.class); builder.addPropertyValue("nodeName", node.getName()) .addPropertyValue("web3j", web3j) .addPropertyReference("blockchainService", web3jServiceBeanName); final String beanName = String.format(NODE_SERVICES_BEAN_NAME, node.getName()); registry.registerBeanDefinition(beanName, builder.getBeanDefinition()); return beanName; }
Example #7
Source File: SpringContainer.java From dorado with Apache License 2.0 | 6 votes |
public synchronized static void create(ApplicationContext applicationContext) { DoradoServerBuilder builder = Dorado.serverConfig; if (builder == null) { throw new IllegalStateException("Please init DoradoServer first!"); } if (!(applicationContext instanceof DoradoApplicationContext) && (applicationContext instanceof BeanDefinitionRegistry)) { ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner( (BeanDefinitionRegistry) applicationContext); scanner.resetFilters(false); scanner.addIncludeFilter(new AnnotationTypeFilter(Controller.class)); scanner.scan(builder.scanPackages()); } instance = new SpringContainer(applicationContext); Dorado.springInitialized = true; }
Example #8
Source File: StatefulFactory.java From statefulj with Apache License 2.0 | 6 votes |
private String registerFinderBean( ReferenceFactory referenceFactory, PersistenceSupportBeanFactory persistenceFactory, StatefulController statefulContollerAnnotation, String repoBeanId, BeanDefinitionRegistry reg) { String finderId = statefulContollerAnnotation.finderId(); if (StringUtils.isEmpty(finderId)) { if (persistenceFactory == null) { throw new RuntimeException("PersistenceFactory is undefined and no finder bean was specified in the StatefulController Annotation for " + statefulContollerAnnotation.clazz()); } if (StringUtils.isEmpty(repoBeanId)) { throw new RuntimeException("No Repository is defined for " + statefulContollerAnnotation.clazz()); } finderId = referenceFactory.getFinderId(); reg.registerBeanDefinition( finderId, persistenceFactory.buildFinderBean(repoBeanId)); } return finderId; }
Example #9
Source File: ServiceAnnotationBeanPostProcessor.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { // 解析指定扫描的包名=》 Set<String> resolvedPackagesToScan = resolvePackagesToScan(packagesToScan); if (!CollectionUtils.isEmpty(resolvedPackagesToScan)) { // 注册服务提供者bean定义=》 registerServiceBeans(resolvedPackagesToScan, registry); } else { if (logger.isWarnEnabled()) { logger.warn("packagesToScan is empty , ServiceBean registry will be ignored!"); } } }
Example #10
Source File: StatefulFactory.java From statefulj with Apache License 2.0 | 6 votes |
private String registerState( ReferenceFactory referenceFactory, Class<?> statefulControllerClass, String state, boolean isBlocking, BeanDefinitionRegistry reg) { String stateId = referenceFactory.getStateId(state); BeanDefinition stateBean = BeanDefinitionBuilder .genericBeanDefinition(StateImpl.class) .getBeanDefinition(); ConstructorArgumentValues args = stateBean.getConstructorArgumentValues(); args.addIndexedArgumentValue(0, state); args.addIndexedArgumentValue(1, false); args.addIndexedArgumentValue(2, isBlocking); reg.registerBeanDefinition(stateId, stateBean); return stateId; }
Example #11
Source File: SampleRegistrar.java From spring-init with Apache License 2.0 | 6 votes |
@Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { registry.registerBeanDefinition("foo", BeanDefinitionBuilder .genericBeanDefinition(Foo.class, () -> foo()).getBeanDefinition()); registry.registerBeanDefinition("bar", BeanDefinitionBuilder .genericBeanDefinition(Bar.class, () -> bar(context.getBean(Foo.class))) .getBeanDefinition()); registry.registerBeanDefinition("runner", BeanDefinitionBuilder .genericBeanDefinition(CommandLineRunner.class, () -> runner(context.getBean(Bar.class))) .getBeanDefinition()); }
Example #12
Source File: AopNamespaceUtils.java From spring-analysis-note with MIT License | 6 votes |
private static void useClassProxyingIfNecessary(BeanDefinitionRegistry registry, @Nullable Element sourceElement) { if (sourceElement != null) { // 这方法作用挺简单的,就是解析下面两个属性,如果是 true,将它们加入代理注册器的属性列表中 // definition.getPropertyValues().add("proxyTargetClass", Boolean.TRUE) boolean proxyTargetClass = Boolean.parseBoolean(sourceElement.getAttribute(PROXY_TARGET_CLASS_ATTRIBUTE)); if (proxyTargetClass) { // 处理 proxy-target-class 属性 // 与代码生成方式有关,在之后步骤中决定使用 jdk 动态代理 或 cglib AopConfigUtils.forceAutoProxyCreatorToUseClassProxying(registry); } boolean exposeProxy = Boolean.parseBoolean(sourceElement.getAttribute(EXPOSE_PROXY_ATTRIBUTE)); if (exposeProxy) { // 处理 expose-proxy 属性 // 扩展增强,有时候目标对象内部的自我调用无法实施切面中的增强,通过这个属性可以同时对两个方法进行增强 AopConfigUtils.forceAutoProxyCreatorToExposeProxy(registry); } } }
Example #13
Source File: MybatisAuditingRegistrar.java From spring-data-mybatis with Apache License 2.0 | 6 votes |
@Override protected void registerAuditListenerBeanDefinition( BeanDefinition auditingHandlerDefinition, BeanDefinitionRegistry registry) { if (!registry.containsBeanDefinition(MYBATIS_MAPPING_CONTEXT_BEAN_NAME)) { registry.registerBeanDefinition(MYBATIS_MAPPING_CONTEXT_BEAN_NAME, // new RootBeanDefinition(MybatisMappingContextFactoryBean.class)); } BeanDefinitionBuilder builder = BeanDefinitionBuilder .rootBeanDefinition(AuditingEntityListener.class); builder.addPropertyValue("auditingHandler", ParsingUtils .getObjectFactoryBeanDefinition(getAuditingHandlerBeanName(), null)); builder.addPropertyReference("sqlSessionTemplate", DEFAULT_SQL_SESSION_TEMPLATE_BEAN_NAME); registerInfrastructureBeanWithId(builder.getRawBeanDefinition(), AuditingEntityListener.class.getName(), registry); }
Example #14
Source File: AnnotationBeanNameGeneratorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void generateBeanNameFromMetaComponentWithNonStringValue() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromNonStringMeta.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); assertEquals("annotationBeanNameGeneratorTests.ComponentFromNonStringMeta", beanName); }
Example #15
Source File: ConfigurationClassBeanDefinitionReader.java From java-technology-stack with MIT License | 5 votes |
/** * Create a new {@link ConfigurationClassBeanDefinitionReader} instance * that will be used to populate the given {@link BeanDefinitionRegistry}. */ ConfigurationClassBeanDefinitionReader(BeanDefinitionRegistry registry, SourceExtractor sourceExtractor, ResourceLoader resourceLoader, Environment environment, BeanNameGenerator importBeanNameGenerator, ImportRegistry importRegistry) { this.registry = registry; this.sourceExtractor = sourceExtractor; this.resourceLoader = resourceLoader; this.environment = environment; this.importBeanNameGenerator = importBeanNameGenerator; this.importRegistry = importRegistry; this.conditionEvaluator = new ConditionEvaluator(registry, environment, resourceLoader); }
Example #16
Source File: AnnotationBeanNameGeneratorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void generateBeanNameFromMetaComponentWithStringValue() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromStringMeta.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); assertEquals("henry", beanName); }
Example #17
Source File: PortalRemoteProxyBeanCreator.java From cuba with Apache License 2.0 | 5 votes |
@Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { String useLocal = AppContext.getProperty("cuba.useLocalServiceInvocation"); if (Boolean.valueOf(useLocal)) { log.info("Configuring proxy beans for local service invocations: {}", services.keySet()); if (!(beanFactory instanceof BeanDefinitionRegistry)) { throw new RuntimeException("beanFactory is not BeanDefinitionRegistry"); } BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; for (Map.Entry<String, String> entry : services.entrySet()) { String name = entry.getKey(); String serviceInterface = entry.getValue(); BeanDefinition definition = new RootBeanDefinition(LocalServiceProxy.class); MutablePropertyValues propertyValues = definition.getPropertyValues(); propertyValues.add("serviceName", name); propertyValues.add("serviceInterface", serviceInterface); registry.registerBeanDefinition(name, definition); log.debug("Configured proxy bean {} of type {}", name, serviceInterface); } processSubstitutions(beanFactory); } else { super.postProcessBeanFactory(beanFactory); } }
Example #18
Source File: ConfigurationClassPostProcessorTests.java From java-technology-stack with MIT License | 5 votes |
@Bean public static BeanDefinitionRegistryPostProcessor bdrpp() { return new BeanDefinitionRegistryPostProcessor() { @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) { registry.registerBeanDefinition("myTestBean", new RootBeanDefinition(TestBean.class)); } @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { } }; }
Example #19
Source File: AmazonRdsInstanceConfiguration.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
protected void registerDataSource(BeanDefinitionRegistry beanDefinitionRegistry, String amazonRdsClientBeanName, String dbInstanceIdentifier, String password, boolean readReplica, String userName, String databaseName) { BeanDefinitionBuilder datasourceBuilder = getBeanDefinitionBuilderForDataSource( readReplica); // Constructor (mandatory) args datasourceBuilder.addConstructorArgReference(amazonRdsClientBeanName); datasourceBuilder.addConstructorArgValue(dbInstanceIdentifier); datasourceBuilder.addConstructorArgValue(password); // optional args datasourceBuilder.addPropertyValue("username", userName); datasourceBuilder.addPropertyValue("databaseName", databaseName); String resourceResolverBeanName = GlobalBeanDefinitionUtils .retrieveResourceIdResolverBeanName(beanDefinitionRegistry); datasourceBuilder.addPropertyReference("resourceIdResolver", resourceResolverBeanName); datasourceBuilder.addPropertyValue("dataSourceFactory", BeanDefinitionBuilder .rootBeanDefinition(TomcatJdbcDataSourceFactory.class) .getBeanDefinition()); beanDefinitionRegistry.registerBeanDefinition(dbInstanceIdentifier, datasourceBuilder.getBeanDefinition()); }
Example #20
Source File: AnnotationBeanNameGenerator.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) { if (definition instanceof AnnotatedBeanDefinition) { String beanName = determineBeanNameFromAnnotation((AnnotatedBeanDefinition) definition); if (StringUtils.hasText(beanName)) { // Explicit bean name found. return beanName; } } // Fallback: generate a unique default bean name. return buildDefaultBeanName(definition, registry); }
Example #21
Source File: XmlBeanDefinitionScannerAgent.java From HotswapAgent with GNU General Public License v2.0 | 5 votes |
private DefaultListableBeanFactory maybeRegistryToBeanFactory() { BeanDefinitionRegistry registry = this.reader.getRegistry(); if (registry instanceof DefaultListableBeanFactory) { return (DefaultListableBeanFactory) registry; } else if (registry instanceof GenericApplicationContext) { return ((GenericApplicationContext) registry).getDefaultListableBeanFactory(); } return null; }
Example #22
Source File: DependsOnDefinitionPostProcessor.java From joyrpc with Apache License 2.0 | 5 votes |
/** * dependsOn操作 */ protected void doDependsOn(BeanDefinitionRegistry registry) { if (onDependsOn.compareAndSet(false, true)) { Set<BeanDefinition> consumers = new HashSet<>(); Set<BeanDefinition> consumerGroups = new HashSet<>(); Set<BeanDefinition> providers = new HashSet<>(); Set<String> contextNames = new HashSet<>(); String[] names = registry.getBeanDefinitionNames(); for (String name : names) { BeanDefinition definition = registry.getBeanDefinition(name); String beanClassName = definition.getBeanClassName(); if (ConsumerBean.class.getName().equals(beanClassName)) { consumers.add(definition); } else if (ProviderBean.class.getName().equals(beanClassName)) { providers.add(definition); } else if (ConsumerGroupBean.class.getName().equals(beanClassName)) { consumerGroups.add(definition); } else if (GlobalParameterBean.class.getName().equals(beanClassName)) { contextNames.add(name); } } String[] dependOnNames = contextNames.toArray(new String[0]); consumers.forEach(definition -> definition.setDependsOn(dependOnNames)); consumerGroups.forEach(definition -> definition.setDependsOn(dependOnNames)); providers.forEach(definition -> definition.setDependsOn(dependOnNames)); } }
Example #23
Source File: ConfigurationClassParser.java From spring-analysis-note with MIT License | 5 votes |
/** * Create a new {@link ConfigurationClassParser} instance that will be used * to populate the set of configuration classes. */ public ConfigurationClassParser(MetadataReaderFactory metadataReaderFactory, ProblemReporter problemReporter, Environment environment, ResourceLoader resourceLoader, BeanNameGenerator componentScanBeanNameGenerator, BeanDefinitionRegistry registry) { this.metadataReaderFactory = metadataReaderFactory; this.problemReporter = problemReporter; this.environment = environment; this.resourceLoader = resourceLoader; this.registry = registry; this.componentScanParser = new ComponentScanAnnotationParser( environment, resourceLoader, componentScanBeanNameGenerator, registry); this.conditionEvaluator = new ConditionEvaluator(registry, environment, resourceLoader); }
Example #24
Source File: NodeBeanRegistrationStrategy.java From eventeum with Apache License 2.0 | 5 votes |
public void register(Node node, BeanDefinitionRegistry registry) { registerContractEventDetailsFactoryBean(node, registry); final Web3jService web3jService = buildWeb3jService(node); final Web3j web3j = buildWeb3j(node, web3jService); final String blockchainServiceBeanName = registerBlockchainServiceBean(node, web3j, registry); registerNodeServicesBean(node, web3j, blockchainServiceBeanName, registry); final String nodeFailureListenerBeanName = registerNodeFailureListener(node, blockchainServiceBeanName, web3jService, registry); registerNodeHealthCheckBean(node, blockchainServiceBeanName, web3jService, nodeFailureListenerBeanName, registry); }
Example #25
Source File: EmbeddedPostgresContextCustomizerFactory.java From embedded-database-spring-test with Apache License 2.0 | 5 votes |
@Override public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) { context.addBeanFactoryPostProcessor(new EnvironmentPostProcessor(context.getEnvironment())); BeanDefinitionRegistry registry = getBeanDefinitionRegistry(context); RootBeanDefinition registrarDefinition = new RootBeanDefinition(); registrarDefinition.setBeanClass(PreloadableEmbeddedPostgresRegistrar.class); registrarDefinition.getConstructorArgumentValues() .addIndexedArgumentValue(0, databaseAnnotations); registry.registerBeanDefinition("preloadableEmbeddedPostgresRegistrar", registrarDefinition); }
Example #26
Source File: EventSourceBeanRegistrar.java From synapse with Apache License 2.0 | 5 votes |
private void registerMessageLogBeanDefinition(final BeanDefinitionRegistry registry, final String beanName, final String channelName, final Class<? extends MessageLog> channelSelector) { registry.registerBeanDefinition( beanName, genericBeanDefinition(DelegateMessageLogReceiverEndpoint.class) .addConstructorArgValue(channelName) .addConstructorArgValue(channelSelector) .setDependencyCheck(DEPENDENCY_CHECK_ALL) .getBeanDefinition() ); LOG.info("Registered MessageLogReceiverEndpoint {} with for channelName {}", beanName, channelName); }
Example #27
Source File: AspectJAutoProxyRegistrar.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Register, escalate, and configure the AspectJ auto proxy creator based on the value * of the @{@link EnableAspectJAutoProxy#proxyTargetClass()} attribute on the importing * {@code @Configuration} class. */ @Override public void registerBeanDefinitions( AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { AopConfigUtils.registerAspectJAnnotationAutoProxyCreatorIfNecessary(registry); AnnotationAttributes enableAJAutoProxy = AnnotationConfigUtils.attributesFor(importingClassMetadata, EnableAspectJAutoProxy.class); if (enableAJAutoProxy.getBoolean("proxyTargetClass")) { AopConfigUtils.forceAutoProxyCreatorToUseClassProxying(registry); } }
Example #28
Source File: JpaContentAutoConfigureRegistrar.java From spring-content with Apache License 2.0 | 5 votes |
@Override protected void registerContentStoreBeanDefinitions( AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { AnnotationMetadata metadata = new StandardAnnotationMetadata( EnableJpaContentAutoConfiguration.class); AnnotationAttributes attributes = new AnnotationAttributes( metadata.getAnnotationAttributes(this.getAnnotation().getName())); String[] basePackages = this.getBasePackages(); Set<GenericBeanDefinition> definitions = StoreUtils.getStoreCandidates(this.getEnvironment(), this.getResourceLoader(), basePackages, multipleStoreImplementationsDetected(), getIdentifyingTypes()); this.buildAndRegisterDefinitions(importingClassMetadata, registry, attributes, basePackages, definitions); }
Example #29
Source File: NacosBeanUtils.java From nacos-spring-project with Apache License 2.0 | 5 votes |
/** * Register Global Nacos Properties Bean with specified name * * @param attributes the attributes of Global Nacos Properties may contain * placeholders * @param registry {@link BeanDefinitionRegistry} * @param propertyResolver {@link PropertyResolver} * @param beanName Bean name */ public static void registerGlobalNacosProperties(AnnotationAttributes attributes, BeanDefinitionRegistry registry, PropertyResolver propertyResolver, String beanName) { if (attributes == null) { return; // Compatible with null } AnnotationAttributes globalPropertiesAttributes = attributes .getAnnotation("globalProperties"); registerGlobalNacosProperties((Map<?, ?>) globalPropertiesAttributes, registry, propertyResolver, beanName); }
Example #30
Source File: BindPointAspectRegistar.java From GyJdbc with Apache License 2.0 | 5 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { if (!inited) { RootBeanDefinition root = new RootBeanDefinition(); root.setBeanClass(BindPointAspect.class); registry.registerBeanDefinition(BindPointAspect.class.getName(), root); inited = true; } }