org.springframework.core.type.AnnotationMetadata Java Examples
The following examples show how to use
org.springframework.core.type.AnnotationMetadata.
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: AbstractFunctionExecutionAutoConfigurationExtension.java From spring-boot-data-geode with Apache License 2.0 | 6 votes |
@SuppressWarnings("unused") @Override protected AbstractFunctionExecutionConfigurationSource newAnnotationBasedFunctionExecutionConfigurationSource( AnnotationMetadata annotationMetadata) { StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(getConfiguration(), true); return new AnnotationFunctionExecutionConfigurationSource(metadata) { @Override public Iterable<String> getBasePackages() { return AutoConfigurationPackages.get(getBeanFactory()); } }; }
Example #2
Source File: GRpcClientRegister.java From faster-framework-project with Apache License 2.0 | 6 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(GRpcClientScan.class.getCanonicalName())); if (annotationAttributes == null) { log.warn("GrpcScan was not found.Please check your configuration."); return; } ClassPathGRpcServiceScanner classPathGrpcServiceScanner = new ClassPathGRpcServiceScanner(registry, beanFactory); classPathGrpcServiceScanner.setResourceLoader(this.resourceLoader); classPathGrpcServiceScanner.addIncludeFilter(new AnnotationTypeFilter(GRpcService.class)); List<String> basePackages = AutoConfigurationPackages.get(this.beanFactory); for (String pkg : annotationAttributes.getStringArray("basePackages")) { if (StringUtils.hasText(pkg)) { basePackages.add(pkg); } } classPathGrpcServiceScanner.doScan(StringUtils.toStringArray(basePackages)); }
Example #3
Source File: MethodMetadataReadingVisitorTests.java From spring-analysis-note with MIT License | 6 votes |
@Override protected AnnotationMetadata get(Class<?> source) { try { ClassLoader classLoader = source.getClassLoader(); String className = source.getName(); String resourcePath = ResourceLoader.CLASSPATH_URL_PREFIX + ClassUtils.convertClassNameToResourcePath(className) + ClassUtils.CLASS_FILE_SUFFIX; Resource resource = new DefaultResourceLoader().getResource(resourcePath); try (InputStream inputStream = new BufferedInputStream( resource.getInputStream())) { ClassReader classReader = new ClassReader(inputStream); AnnotationMetadataReadingVisitor metadata = new AnnotationMetadataReadingVisitor( classLoader); classReader.accept(metadata, ClassReader.SKIP_DEBUG); return metadata; } } catch (Exception ex) { throw new IllegalStateException(ex); } }
Example #4
Source File: AnnotationBeanNameGenerator.java From java-technology-stack with MIT License | 6 votes |
/** * Derive a bean name from one of the annotations on the class. * @param annotatedDef the annotation-aware bean definition * @return the bean name, or {@code null} if none is found */ @Nullable protected String determineBeanNameFromAnnotation(AnnotatedBeanDefinition annotatedDef) { AnnotationMetadata amd = annotatedDef.getMetadata(); Set<String> types = amd.getAnnotationTypes(); String beanName = null; for (String type : types) { AnnotationAttributes attributes = AnnotationConfigUtils.attributesFor(amd, type); if (attributes != null && isStereotypeWithNameValue(type, amd.getMetaAnnotationTypes(type), attributes)) { Object value = attributes.get("value"); if (value instanceof String) { String strVal = (String) value; if (StringUtils.hasLength(strVal)) { if (beanName != null && !strVal.equals(beanName)) { throw new IllegalStateException("Stereotype annotations suggest inconsistent " + "component names: '" + beanName + "' versus '" + strVal + "'"); } beanName = strVal; } } } } return beanName; }
Example #5
Source File: AbstractRetrofitClientsRegistrar.java From spring-cloud-square with Apache License 2.0 | 6 votes |
private void registerRetrofitClient(BeanDefinitionRegistry registry, AnnotationMetadata annotationMetadata, Map<String, Object> attributes) { String className = annotationMetadata.getClassName(); BeanDefinitionBuilder definition = BeanDefinitionBuilder .genericBeanDefinition(getFactoryBeanClass()); validate(attributes); definition.addPropertyValue("url", getUrl(attributes)); String name = getName(attributes); definition.addPropertyValue("name", name); definition.addPropertyValue("type", className); definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE); String alias = name + "RetrofitClient"; AbstractBeanDefinition beanDefinition = definition.getBeanDefinition(); beanDefinition.setPrimary(true); String qualifier = getQualifier(attributes); if (StringUtils.hasText(qualifier)) { alias = qualifier; } BeanDefinitionHolder holder = new BeanDefinitionHolder(beanDefinition, className, new String[] { alias }); BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry); }
Example #6
Source File: WebAdminComponentScanRegistrar.java From wallride with Apache License 2.0 | 6 votes |
private Set<String> getPackagesToScan(AnnotationMetadata metadata) { AnnotationAttributes attributes = AnnotationAttributes .fromMap(metadata.getAnnotationAttributes(WebAdminComponentScan.class.getName())); String[] value = attributes.getStringArray("value"); String[] basePackages = attributes.getStringArray("basePackages"); Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses"); if (!ObjectUtils.isEmpty(value)) { Assert.state(ObjectUtils.isEmpty(basePackages), "@WebAdminComponentScan basePackages and value attributes are mutually exclusive"); } Set<String> packagesToScan = new LinkedHashSet<String>(); packagesToScan.addAll(Arrays.asList(value)); packagesToScan.addAll(Arrays.asList(basePackages)); for (Class<?> basePackageClass : basePackageClasses) { packagesToScan.add(ClassUtils.getPackageName(basePackageClass)); } if (packagesToScan.isEmpty()) { return Collections.singleton(ClassUtils.getPackageName(metadata.getClassName())); } return packagesToScan; }
Example #7
Source File: RestApiClentRegistrar.java From onetwo with Apache License 2.0 | 6 votes |
@Override protected BeanDefinitionBuilder createApiClientFactoryBeanBuilder(AnnotationMetadata annotationMetadata, AnnotationAttributes attributes) { String className = annotationMetadata.getClassName(); BeanDefinitionBuilder definition = BeanDefinitionBuilder.genericBeanDefinition(DefaultApiClientFactoryBean.class); definition.addPropertyValue("url", resolveUrl(attributes)); definition.addPropertyValue("path", resolvePath(attributes)); // definition.addPropertyValue("name", name); definition.addPropertyValue("interfaceClass", className); // definition.addPropertyValue("restExecutor", getRestExecutor()); definition.addPropertyReference("restExecutor", RestExecutorFactory.REST_EXECUTOR_FACTORY_BEAN_NAME); // definition.addPropertyValue("decode404", attributes.get("decode404")); // definition.addPropertyValue("fallback", attributes.get("fallback")); definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE); return definition; }
Example #8
Source File: ImportSelectorTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void importSelectorsSeparateWithGroup() { DefaultListableBeanFactory beanFactory = spy(new DefaultListableBeanFactory()); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(beanFactory); context.register(GroupedConfig1.class); context.register(GroupedConfig2.class); context.refresh(); InOrder ordered = inOrder(beanFactory); ordered.verify(beanFactory).registerBeanDefinition(eq("c"), any()); ordered.verify(beanFactory).registerBeanDefinition(eq("d"), any()); assertThat(TestImportGroup.instancesCount.get(), equalTo(1)); assertThat(TestImportGroup.imports.size(), equalTo(2)); Iterator<AnnotationMetadata> iterator = TestImportGroup.imports.keySet().iterator(); assertThat(iterator.next().getClassName(), equalTo(GroupedConfig2.class.getName())); assertThat(iterator.next().getClassName(), equalTo(GroupedConfig1.class.getName())); }
Example #9
Source File: RedisHttpSessionConfiguration.java From spring-session with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("deprecation") public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> attributeMap = importMetadata .getAnnotationAttributes(EnableRedisHttpSession.class.getName()); AnnotationAttributes attributes = AnnotationAttributes.fromMap(attributeMap); this.maxInactiveIntervalInSeconds = attributes.getNumber("maxInactiveIntervalInSeconds"); String redisNamespaceValue = attributes.getString("redisNamespace"); if (StringUtils.hasText(redisNamespaceValue)) { this.redisNamespace = this.embeddedValueResolver.resolveStringValue(redisNamespaceValue); } FlushMode flushMode = attributes.getEnum("flushMode"); RedisFlushMode redisFlushMode = attributes.getEnum("redisFlushMode"); if (flushMode == FlushMode.ON_SAVE && redisFlushMode != RedisFlushMode.ON_SAVE) { flushMode = redisFlushMode.getFlushMode(); } this.flushMode = flushMode; this.saveMode = attributes.getEnum("saveMode"); String cleanupCron = attributes.getString("cleanupCron"); if (StringUtils.hasText(cleanupCron)) { this.cleanupCron = cleanupCron; } }
Example #10
Source File: CustomScopeAnnotationConfigurer.java From joinfaces with Apache License 2.0 | 5 votes |
protected String deduceScopeName(AnnotationMetadata classMetadata) { if (classMetadata == null || getAnnotationToScopeMappings() == null) { return null; } for (AnnotationToScopeMapping annotationToScopeMapping : getAnnotationToScopeMappings()) { if (classMetadata.hasAnnotation(annotationToScopeMapping.getAnnotation().getName())) { return annotationToScopeMapping.getScope(); } } return null; }
Example #11
Source File: ImportAwareTests.java From java-technology-stack with MIT License | 5 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClassName(String.class.getName()); registry.registerBeanDefinition("registrarImportedBean", beanDefinition); GenericBeanDefinition beanDefinition2 = new GenericBeanDefinition(); beanDefinition2.setBeanClass(OtherImportedConfig.class); registry.registerBeanDefinition("registrarImportedConfig", beanDefinition2); Assert.state(!called, "ImportedRegistrar called twice"); called = true; }
Example #12
Source File: MybatisPlusAutoConfig.java From seata-samples with Apache License 2.0 | 5 votes |
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { MybatisPlusAutoConfig.logger.debug("Searching for mappers annotated with @Mapper"); ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); try { if (this.resourceLoader != null) { scanner.setResourceLoader(this.resourceLoader); } List<String> packages = AutoConfigurationPackages.get(this.beanFactory); if (MybatisPlusAutoConfig.logger.isDebugEnabled()) { Iterator iterator = packages.iterator(); while(iterator.hasNext()) { String pkg = (String)iterator.next(); MybatisPlusAutoConfig.logger.debug("Using auto-configuration base package '" + pkg + "'"); } } scanner.setAnnotationClass(Mapper.class); scanner.registerFilters(); scanner.doScan(StringUtils.toStringArray(packages)); } catch (IllegalStateException var7) { MybatisPlusAutoConfig.logger.debug("Could not determine auto-configuration package, automatic mapper scanning disabled." + var7); } }
Example #13
Source File: AnnotatedBeanDefinitionRegistryUtils.java From spring-context-support with Apache License 2.0 | 5 votes |
/** * Is present bean that was registered by the specified {@link Annotation annotated} {@link Class class} * * @param registry {@link BeanDefinitionRegistry} * @param annotatedClass the {@link Annotation annotated} {@link Class class} * @return if present, return <code>true</code>, or <code>false</code> * @since 1.0.3 */ public static boolean isPresentBean(BeanDefinitionRegistry registry, Class<?> annotatedClass) { boolean present = false; String[] beanNames = registry.getBeanDefinitionNames(); ClassLoader classLoader = annotatedClass.getClassLoader(); for (String beanName : beanNames) { BeanDefinition beanDefinition = registry.getBeanDefinition(beanName); if (beanDefinition instanceof AnnotatedBeanDefinition) { AnnotationMetadata annotationMetadata = ((AnnotatedBeanDefinition) beanDefinition).getMetadata(); String className = annotationMetadata.getClassName(); Class<?> targetClass = resolveClassName(className, classLoader); present = nullSafeEquals(targetClass, annotatedClass); if (present) { if (logger.isDebugEnabled()) { logger.debug(format("The annotatedClass[class : %s , bean name : %s] was present in registry[%s]", className, beanName, registry)); } break; } } } return present; }
Example #14
Source File: ConfigurationClassPostProcessor.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object postProcessBeforeInitialization(Object bean, String beanName) { if (bean instanceof ImportAware) { ImportRegistry ir = this.beanFactory.getBean(IMPORT_REGISTRY_BEAN_NAME, ImportRegistry.class); AnnotationMetadata importingClass = ir.getImportingClassFor(bean.getClass().getSuperclass().getName()); if (importingClass != null) { ((ImportAware) bean).setImportMetadata(importingClass); } } return bean; }
Example #15
Source File: ImportAwareTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void indirectlyAnnotatedWithImport() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(IndirectlyImportingConfig.class); ctx.refresh(); assertNotNull(ctx.getBean("importedConfigBean")); ImportedConfig importAwareConfig = ctx.getBean(ImportedConfig.class); AnnotationMetadata importMetadata = importAwareConfig.importMetadata; assertThat("import metadata was not injected", importMetadata, notNullValue()); assertThat(importMetadata.getClassName(), is(IndirectlyImportingConfig.class.getName())); AnnotationAttributes enableAttribs = AnnotationConfigUtils.attributesFor(importMetadata, EnableImportedConfig.class); String foo = enableAttribs.getString("foo"); assertThat(foo, is("xyz")); }
Example #16
Source File: FeignClientsRegistrar.java From spring-cloud-openfeign with Apache License 2.0 | 5 votes |
private void registerFeignClient(BeanDefinitionRegistry registry, AnnotationMetadata annotationMetadata, Map<String, Object> attributes) { String className = annotationMetadata.getClassName(); BeanDefinitionBuilder definition = BeanDefinitionBuilder .genericBeanDefinition(FeignClientFactoryBean.class); validate(attributes); definition.addPropertyValue("url", getUrl(attributes)); definition.addPropertyValue("path", getPath(attributes)); String name = getName(attributes); definition.addPropertyValue("name", name); String contextId = getContextId(attributes); definition.addPropertyValue("contextId", contextId); definition.addPropertyValue("type", className); definition.addPropertyValue("decode404", attributes.get("decode404")); definition.addPropertyValue("fallback", attributes.get("fallback")); definition.addPropertyValue("fallbackFactory", attributes.get("fallbackFactory")); definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE); String alias = contextId + "FeignClient"; AbstractBeanDefinition beanDefinition = definition.getBeanDefinition(); beanDefinition.setAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE, className); // has a default, won't be null boolean primary = (Boolean) attributes.get("primary"); beanDefinition.setPrimary(primary); String qualifier = getQualifier(attributes); if (StringUtils.hasText(qualifier)) { alias = qualifier; } BeanDefinitionHolder holder = new BeanDefinitionHolder(beanDefinition, className, new String[] { alias }); BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry); }
Example #17
Source File: RedisWebSessionConfiguration.java From spring-session with Apache License 2.0 | 5 votes |
@Override public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> attributeMap = importMetadata .getAnnotationAttributes(EnableRedisWebSession.class.getName()); AnnotationAttributes attributes = AnnotationAttributes.fromMap(attributeMap); this.maxInactiveIntervalInSeconds = attributes.getNumber("maxInactiveIntervalInSeconds"); String redisNamespaceValue = attributes.getString("redisNamespace"); if (StringUtils.hasText(redisNamespaceValue)) { this.redisNamespace = this.embeddedValueResolver.resolveStringValue(redisNamespaceValue); } this.saveMode = attributes.getEnum("saveMode"); }
Example #18
Source File: CustomChatDefinitionRegistrar.java From netty-chat with Apache License 2.0 | 5 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry){ Class beanClass = CustomOfflineInfoHelper.class; RootBeanDefinition beanDefinition = new RootBeanDefinition(beanClass); String beanName = StringUtils.uncapitalize(beanClass.getSimpleName()); //在这里可以拿到所有注解的信息,可以根据不同注解来返回不同的class,从而达到开启不同功能的目的 //通过这种方式可以自定义beanName registry.registerBeanDefinition(beanName, beanDefinition); }
Example #19
Source File: AbstractStoreBeanDefinitionRegistrar.java From spring-content with Apache License 2.0 | 5 votes |
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { Assert.notNull(importingClassMetadata, "AnnotationMetadata must not be null!"); Assert.notNull(registry, "BeanDefinitionRegistry must not be null!"); Assert.isTrue(registry instanceof ConfigurableListableBeanFactory, "BeanDefinitionRegistry must be instance of ConfigurableListableBeanFactory"); // Guard against calls for sub-classes // if (importingClassMetadata.getAnnotationAttributes(getAnnotation().getName()) // == null) { // return; // } RootBeanDefinition repositoryInterfacePostProcessor = new RootBeanDefinition(REPOSITORY_INTERFACE_POST_PROCESSOR); repositoryInterfacePostProcessor.setSource(importingClassMetadata); if (registry.containsBeanDefinition(REPOSITORY_INTERFACE_POST_PROCESSOR) == false) { registry.registerBeanDefinition(REPOSITORY_INTERFACE_POST_PROCESSOR,repositoryInterfacePostProcessor); } BeanDefinition storeServiceBeanDef = createBeanDefinition(ContentStoreServiceImpl.class); if (registry.containsBeanDefinition("contentStoreService") == false) { registry.registerBeanDefinition("contentStoreService", storeServiceBeanDef); } BeanDefinition annotatedStoreEventHandlerDef = createBeanDefinition(AnnotatedStoreEventInvoker.class); if (registry.containsBeanDefinition("annotatedStoreEventHandler") == false) { registry.registerBeanDefinition("annotatedStoreEventHandler", annotatedStoreEventHandlerDef); } if (registry.containsBeanDefinition("renditionService") == false) { BeanDefinition renditionServiceBeanDef = createBeanDefinition(RenditionServiceImpl.class); registry.registerBeanDefinition("renditionService", renditionServiceBeanDef); } createOperationsBean(registry); registerContentStoreBeanDefinitions(importingClassMetadata, registry); }
Example #20
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 #21
Source File: GspAutoConfiguration.java From grails-boot with Apache License 2.0 | 5 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { if(removeDefaultViewResolverBean) { if(registry.containsBeanDefinition("defaultViewResolver")) { registry.removeBeanDefinition("defaultViewResolver"); } } if(replaceViewResolverBean) { if(registry.containsBeanDefinition("viewResolver")) { registry.removeBeanDefinition("viewResolver"); } registry.registerAlias("gspViewResolver", "viewResolver"); } }
Example #22
Source File: ArchaiusConfigMapSourceRegistar.java From spring-cloud-kubernetes with Apache License 2.0 | 5 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) { Map<String, Object> source = metadata.getAnnotationAttributes(ArchaiusConfigMapSource.class.getName(), true); String name = getSourceName(source); String namespace = getSourceNamespace(source); if (name != null) { registerSourceConfiguration(registry, name, namespace); } }
Example #23
Source File: TeiidPostProcessor.java From teiid-spring-boot with Apache License 2.0 | 5 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { if (!registry.containsBeanDefinition(BEAN_NAME)) { GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClass(TeiidPostProcessor.class); beanDefinition.setRole(BeanDefinition.ROLE_APPLICATION); // We don't need this one to be post processed otherwise it can cause a // cascade of bean instantiation that we would rather avoid. beanDefinition.setSynthetic(true); registry.registerBeanDefinition(BEAN_NAME, beanDefinition); } }
Example #24
Source File: ActivemqChatDefinitionRegistrar.java From netty-chat with Apache License 2.0 | 5 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry){ Class beanClass = ActivemqOfflineInfoHelper.class; RootBeanDefinition beanDefinition = new RootBeanDefinition(beanClass); String beanName = StringUtils.uncapitalize(beanClass.getSimpleName()); //在这里可以拿到所有注解的信息,可以根据不同注解来返回不同的class,从而达到开启不同功能的目的 //通过这种方式可以自定义beanName registry.registerBeanDefinition(beanName, beanDefinition); }
Example #25
Source File: MemberNameConfiguration.java From spring-boot-data-geode with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("all") public void setImportMetadata(AnnotationMetadata importMetadata) { if (isAnnotationPresent(importMetadata)) { AnnotationAttributes memberNameAttributes = getAnnotationAttributes(importMetadata); setMemberName(memberNameAttributes.containsKey("value") ? memberNameAttributes.getString("value") : null); setMemberName(memberNameAttributes.containsKey("name") ? memberNameAttributes.getString("name") : null); } }
Example #26
Source File: EnableJFishOauth2Selector.java From onetwo with Apache License 2.0 | 5 votes |
@Override protected Set<String> doSelect(AnnotationMetadata metadata, AnnotationAttributes attributes) { Set<String> classNames = new HashSet<String>(); List<OAuth2Role> roles = Arrays.asList((OAuth2Role[])attributes.get("value")); classNames.add(PasswordEncoderConfiguration.class.getName()); if(roles.contains(OAuth2Role.AUTHORIZATION_SERVER)){ classNames.add(AuthorizationServerConfiguration.class.getName()); classNames.add(Oauth2TokenStoreConfiguration.class.getName()); classNames.add(OAuth2CustomResultConfiguration.class.getName()); } if(roles.contains(OAuth2Role.RESOURCE_SERVER)){ if(!classNames.contains(Oauth2TokenStoreConfiguration.class.getName())){ classNames.add(Oauth2TokenStoreConfiguration.class.getName()); } //仍然可通过ResourceServerProps.ENABLED_KEY关掉 classNames.add(ResourceServerConfiguration.class.getName()); classNames.add(OAuth2CustomResultConfiguration.class.getName()); classNames.add(ClientDetailsResolverConfiguration.class.getName()); } if(roles.contains(OAuth2Role.CLIENT_DETAILS_RESOLVER)){ classNames.add(Oauth2TokenStoreConfiguration.class.getName()); classNames.add(ClientDetailsResolverConfiguration.class.getName()); } return classNames; }
Example #27
Source File: WindowConfig.java From cuba with Apache License 2.0 | 5 votes |
protected void registerScreen(String id, WindowInfo windowInfo) { String controllerClassName = windowInfo.getControllerClassName(); if (controllerClassName != null) { MetadataReader classMetadata = loadClassMetadata(controllerClassName); AnnotationMetadata annotationMetadata = classMetadata.getAnnotationMetadata(); registerPrimaryEditor(windowInfo, annotationMetadata); registerPrimaryLookup(windowInfo, annotationMetadata); } screens.put(id, windowInfo); registerScreenRoute(id, windowInfo); }
Example #28
Source File: ConfigurationClassParser.java From java-technology-stack with MIT License | 5 votes |
@Override public void removeImportingClass(String importingClass) { for (List<AnnotationMetadata> list : this.imports.values()) { for (Iterator<AnnotationMetadata> iterator = list.iterator(); iterator.hasNext();) { if (iterator.next().getClassName().equals(importingClass)) { iterator.remove(); break; } } } }
Example #29
Source File: MBeanExportConfiguration.java From java-technology-stack with MIT License | 5 votes |
@Override public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableMBeanExport.class.getName()); this.enableMBeanExport = AnnotationAttributes.fromMap(map); if (this.enableMBeanExport == null) { throw new IllegalArgumentException( "@EnableMBeanExport is not present on importing class " + importMetadata.getClassName()); } }
Example #30
Source File: EnableMenuImportSelector.java From spring-backend-boilerplate with Apache License 2.0 | 5 votes |
@Override public String[] selectImports(AnnotationMetadata metadata) { MultiValueMap<String,Object> attributes = metadata.getAllAnnotationAttributes(EnableMenu.class.getName(), false); String pluginId = attributes == null ? null : (String) attributes.getFirst("pluginId"); if (StringUtils.isEmpty(pluginId)) { return new String[0]; } return new String[]{MenuPluginBeanRegistrar.class.getName()}; }