当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationAttributes.fromMap方法代码示例

本文整理汇总了Java中org.springframework.core.annotation.AnnotationAttributes.fromMap方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationAttributes.fromMap方法的具体用法?Java AnnotationAttributes.fromMap怎么用?Java AnnotationAttributes.fromMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.core.annotation.AnnotationAttributes的用法示例。


在下文中一共展示了AnnotationAttributes.fromMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerBeanDefinitions

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
	AnnotationAttributes enableMenu = AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(EnableMenu.class
																											.getName(),
																									false));

	if (enableMenu != null) {
		BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(DefaultMenuPlugin.class);
		AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();

		MutablePropertyValues mutablePropertyValues = new MutablePropertyValues();
		mutablePropertyValues.add("extensionPointId", enableMenu.getString("extensionPointId"));
		mutablePropertyValues.add("pluginId", enableMenu.getString("pluginId"));
		mutablePropertyValues.add("menu", toMenu(enableMenu.getAnnotationArray("menu")));
		beanDefinition.setPropertyValues(mutablePropertyValues);

		registry.registerBeanDefinition("menuPlugin:" + enableMenu.getString("pluginId"), beanDefinition);
	}
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:20,代码来源:EnableMenuImportSelector.java

示例2: selectImports

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
/**
 * selectImports
 * <p>
 * Provides a configuration list of additional Import which should be performed to
 * implement the applicable configuration.
 *
 * @param importingClassMetadata Annotations Metadata to use to construct Imports.
 * @return String Array of Configuration Imports.
 */
@Override
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
    AnnotationAttributes attributes =
            AnnotationAttributes.fromMap(
                    importingClassMetadata.getAnnotationAttributes(EnableYourMicroservice.class.getName(), false));
    String environmentType = attributes.getString("environmentType");
    LOGGER.info("Using specified EnvironmentType:[{}]", environmentType);
    /**
     *  Create our necessary Imports.
     */
    return new String[]{
            YourMicroserviceEnvironmentConfiguration.class.getName()

            // Add Security Import as Applicable ...
    };

}
 
开发者ID:jaschenk,项目名称:Your-Microservice,代码行数:27,代码来源:YourMicroserviceBeanConfiguration.java

示例3: registerBeanDefinitions

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
  AnnotationAttributes attributes = AnnotationAttributes.fromMap(importingClassMetadata
      .getAnnotationAttributes(EnableApolloConfig.class.getName()));
  String[] namespaces = attributes.getStringArray("value");
  int order = attributes.getNumber("order");
  PropertySourcesProcessor.addNamespaces(Lists.newArrayList(namespaces), order);

  BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, PropertySourcesPlaceholderConfigurer.class.getName(),
      PropertySourcesPlaceholderConfigurer.class);

  BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, PropertySourcesProcessor.class.getName(),
      PropertySourcesProcessor.class);

  BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, ApolloAnnotationProcessor.class.getName(),
      ApolloAnnotationProcessor.class);
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:18,代码来源:ApolloConfigRegistrar.java

示例4: selectImports

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
    AnnotationAttributes attributes = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(EnableSearch.class.getName(), false));
    Assert.notNull(attributes, String.format("@%s is not present on importing class '%s' as expected", EnableSearch.class.getName(), importingClassMetadata.getClassName()));

    List<String> imports = new ArrayList<>();

    SearchType searchType = attributes.getEnum(SEARCH_TYPE_ATTRIBUTE_NAME);
    if (SearchType.SOLR.equals(searchType)) {
        imports.add(SolrConfiguration.class.getName());
    } else if (SearchType.LUCENE.equals(searchType)) {
        imports.add(LuceneConfiguration.class.getName());
    }

    return imports.toArray(new String[imports.size()]);
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:17,代码来源:SearchConfigurationSelector.java

示例5: getPackagesToScan

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
    AnnotationAttributes attributes = AnnotationAttributes
            .fromMap(metadata.getAnnotationAttributes(ServletComponentScan.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),
                "@ServletComponentScan 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;
}
 
开发者ID:PebbleTemplates,项目名称:pebble-spring-boot-starter,代码行数:22,代码来源:ServletComponentScanRegistrar.java

示例6: getPackagesToScan

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
	AnnotationAttributes attributes = AnnotationAttributes.fromMap(
			metadata.getAnnotationAttributes(ServletComponentScan.class.getName()));
	String[] basePackages = attributes.getStringArray("basePackages");
	Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses");
	Set<String> packagesToScan = new LinkedHashSet<String>();
	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;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:ServletComponentScanRegistrar.java

示例7: getPackagesToScan

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
	AnnotationAttributes attributes = AnnotationAttributes.fromMap(
			metadata.getAnnotationAttributes(EntityScan.class.getName()));
	String[] basePackages = attributes.getStringArray("basePackages");
	Class<?>[] basePackageClasses = attributes
			.getClassArray("basePackageClasses");
	Set<String> packagesToScan = new LinkedHashSet<String>();
	packagesToScan.addAll(Arrays.asList(basePackages));
	for (Class<?> basePackageClass : basePackageClasses) {
		packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
	}
	if (packagesToScan.isEmpty()) {
		String packageName = ClassUtils.getPackageName(metadata.getClassName());
		Assert.state(!StringUtils.isEmpty(packageName),
				"@EntityScan cannot be used with the default package");
		return Collections.singleton(packageName);
	}
	return packagesToScan;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:20,代码来源:EntityScanPackages.java

示例8: getPackagesToScan

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
	AnnotationAttributes attributes = AnnotationAttributes.fromMap(
			metadata.getAnnotationAttributes(ServletComponentScan.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),
				"@ServletComponentScan 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;
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:24,代码来源:ServletComponentScanRegistrar.java

示例9: getMatchOutcome

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
    AnnotationAttributes attributes = AnnotationAttributes
            .fromMap(metadata.getAnnotationAttributes(ConditionalOnEnabledDetector.class.getName()));
    final String name = attributes.getString("value");
    final String prefix = attributes.getString("prefix");
    RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(),
            prefix + "." + name + ".");
    Boolean enabled = resolver.getProperty("enabled", Boolean.class, true);
    return new ConditionOutcome(enabled, ConditionMessage.forCondition(ConditionalOnEnabledDetector.class, name)
            .because(enabled ? "enabled" : "disabled"));
}
 
开发者ID:cereebro,项目名称:cereebro,代码行数:13,代码来源:OnEnabledDetectorCondition.java

示例10: setImportMetadata

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
	AnnotationAttributes attributes = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(EnableSpringSeedRestApiMvc.class.getName()));
	this.disableCors =  attributes.getBoolean("disableCors");
	this.parseAuthorizationHeader = attributes.getBoolean("parseAuthorizationHeader");
	AnnotationAttributes jwt = attributes.getAnnotation("enableJwtConfig");
	this.jwtValue = jwt.getBoolean("value");
	this.jwtSecretPropertyName = jwt.getString("secretPropertyName");
	this.expiration = jwt.getNumber("expiration").longValue();

	this.enableSwagger2 = attributes.getBoolean("enableSwagger2");
}
 
开发者ID:profullstack,项目名称:spring-seed,代码行数:13,代码来源:SpringSeedRestApiMvcConfigration.java

示例11: setImportMetadata

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
	Map<String, Object> attributes = AnnotationAttributes.fromMap(importMetadata
			.getAnnotationAttributes(EnableWamp.class.getName(), false));
	if (attributes != null) {
		Feature[] disableFeatures = (Feature[]) attributes.get("disable");
		if (disableFeatures != null) {
			for (Feature disableFeature : disableFeatures) {
				this.features.disable(disableFeature);
			}
		}
	}
}
 
开发者ID:ralscha,项目名称:wamp2spring,代码行数:14,代码来源:WampConfiguration.java

示例12: setImportMetadata

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
/**
 * setImportMetadata
 *
 * @param importMetadata Annotations Metadata to validate...
 */
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
    Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableYourMicroservice.class.getName());
    this.enableYourMicroservice = AnnotationAttributes.fromMap(map);
    if (this.enableYourMicroservice == null) {
        String message =
                "@EnableYourMicroservice is not present on importing class " + importMetadata.getClassName();
        LOGGER.error(message);
        throw new IllegalArgumentException(message);
    }
}
 
开发者ID:jaschenk,项目名称:Your-Microservice,代码行数:17,代码来源:YourMicroserviceBeanConfiguration.java

示例13: registerBeanDefinitions

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
	public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
		AnnotationAttributes attributes = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(EnableSpringSeedJpa.class.getName()));
		String propertyPrefix = attributes.getString("propertyPrefix");
		String beanNamePrefix =  attributes.getString("beanNamePrefix");
		Class<?>[] entityPackages = attributes.getClassArray("baseEntityClasses");

/*
		//There are two ways to register bean dynamically in Spring.
 		DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory)this.beanFactory;

		DataSource dataSource = JpaBuilderUtil.newDataSource(environment, prefix);
		beanFactory.registerSingleton(prefix + DataSource.class.getSimpleName(), dataSource);

		EntityManagerFactory entityManagerFactory = JpaBuilderUtil.newEntityManagerFactory(dataSource, entityPackages);
		beanFactory.registerSingleton(prefix + "entityManager", entityManagerFactory);

		PlatformTransactionManager platformTransactionManager = JpaBuilderUtil.newPlatformTransactionManager(entityManagerFactory);
		beanFactory.registerSingleton(prefix + "transactionManager", platformTransactionManager);
*/

		BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(Dbcp2DataSourceFactoryBean.class)
			.addPropertyValue("prefix", propertyPrefix)
			.addPropertyValue("environment", this.environment)
			.setDestroyMethodName("close");
		String dataSourceName = beanNamePrefix.isEmpty()? "dataSource": beanNamePrefix + "DataSource";
		registry.registerBeanDefinition(dataSourceName, builder.getBeanDefinition());

		BeanDefinitionBuilder builderEntity = BeanDefinitionBuilder.genericBeanDefinition(EntityManagerFactoryFactoryBean.class)
			.addPropertyReference("dataSource", dataSourceName)
			.addPropertyValue("entityPackages", entityPackages);
		String entityManagerFactoryName = beanNamePrefix.isEmpty()? "entityManagerFactory": beanNamePrefix + "EntityManagerFactory";
		registry.registerBeanDefinition(entityManagerFactoryName, builderEntity.getBeanDefinition());

		BeanDefinitionBuilder builderTrans = BeanDefinitionBuilder.genericBeanDefinition(JpaTransactionManagerFactoryBean.class)
			.addPropertyReference("entityManagerFactory",entityManagerFactoryName);
		String transactionManagerName = beanNamePrefix.isEmpty()? "transactionManager": beanNamePrefix + "TransactionManager";
		registry.registerBeanDefinition(transactionManagerName, builderTrans.getBeanDefinition());
	}
 
开发者ID:profullstack,项目名称:spring-seed,代码行数:40,代码来源:SpringSeedJpa.java

示例14: registerBeanDefinitions

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata importMetadata, BeanDefinitionRegistry registry) {
  AnnotationAttributes attributes = AnnotationAttributes.fromMap(
          importMetadata.getAnnotationAttributes(JpaWithSnowdropConfiguration.class.getName(), false));
  if (attributes == null) {
    throw new IllegalArgumentException(
            "@JpaWithSnowdropConfiguration is not present on importing class " + importMetadata.getClassName());
  }
  registry.registerBeanDefinition(
          JpaRepositoryFactoryBeanSnowdropPostProcessor.class.getName(),
          buildPostProcessorDefinition(importMetadata, attributes)
  );
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:14,代码来源:JpaWithSnowdropRegistrar.java

示例15: setImportMetadata

import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void setImportMetadata(AnnotationMetadata annotationMetadata) {
    Map<String, Object> map = annotationMetadata.getAnnotationAttributes(starterClass.getName());
    AnnotationAttributes attributes = AnnotationAttributes.fromMap(map);

    initialize(attributes, new AppstatusConfigBuilder(attributes));
}
 
开发者ID:appstatus,项目名称:appstatus-spring-boot-starter,代码行数:8,代码来源:AbstractAppstatusImportAware.java


注:本文中的org.springframework.core.annotation.AnnotationAttributes.fromMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。