本文整理汇总了Java中org.springframework.core.annotation.AnnotationAttributes.getString方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationAttributes.getString方法的具体用法?Java AnnotationAttributes.getString怎么用?Java AnnotationAttributes.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.annotation.AnnotationAttributes
的用法示例。
在下文中一共展示了AnnotationAttributes.getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 ...
};
}
示例2: buildPostProcessorDefinition
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private BeanDefinition buildPostProcessorDefinition(AnnotationMetadata importMetadata, AnnotationAttributes attributes) {
SnowdropRepositoryConfigExtension extension = new SnowdropRepositoryConfigExtension();
BeanDefinitionBuilder builder = BeanDefinitionBuilder
.rootBeanDefinition(JpaRepositoryFactoryBeanSnowdropPostProcessor.class);
builder.getRawBeanDefinition().setSource(importMetadata);
builder.addPropertyValue("queryLookupStrategyKey", attributes.get(QUERY_LOOKUP_STRATEGY));
NamedQueriesBeanDefinitionBuilder definitionBuilder = new NamedQueriesBeanDefinitionBuilder(
extension.getDefaultNamedQueryLocation());
String namedQueriesLocation = attributes.getString(NAMED_QUERIES_LOCATION);
if (StringUtils.hasText(namedQueriesLocation)) {
definitionBuilder.setLocations(namedQueriesLocation);
}
builder.addPropertyValue("namedQueriesLocation", definitionBuilder.build(importMetadata));
return builder.getBeanDefinition();
}
示例3: DataSourceBean
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
DataSourceBean(AnnotationAttributes[] dataSources) {
beanDefinitions = new HashMap<>(dataSources.length);
dataSourceNames = new ArrayList<>(dataSources.length);
for (int i = 0; i < dataSources.length; i++) {
AnnotationAttributes attr = dataSources[i];
String name = attr.getString(Constant.DATA_SOURCE_NAME_ATTRIBUTE_NAME);
BeanDefinition dsBeanDefinition = new RdbmsDataSourceBeanDefinitionBuilder(name).build();
if (i == 0) {
defaultDataSourceKey = attr.getString(Constant.DATA_SOURCE_NAME_ATTRIBUTE_NAME);
defaultDataSource = dsBeanDefinition;
}
beanDefinitions.put(name, dsBeanDefinition);
dataSourceNames.add(name);
}
}
示例4: registerBeanDefinitions
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
Boolean enableSpringfox = Profiles.getProfile("springfox");
if (!enableSpringfox) {
return;
}
AnnotationAttributes attributes = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(EnableSpringFox.class.getName(), false));
Assert.notNull(attributes, String.format("@%s is not present on importing class '%s' as expected", EnableSpringFox.class.getName(), importingClassMetadata.getClassName()));
String prefix = attributes.getString(PREFIX_ATTRIBUTE_NAME);
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(SpringFoxPathProvider.class);
builder.addPropertyValue("prefix", prefix);
registry.registerBeanDefinition(SpringFoxPathProvider.class.getName(), builder.getBeanDefinition());
String[] groups = attributes.getStringArray(GROUPS_ATTRIBUTE_NAME);
for (String group : groups) {
BeanDefinitionBuilder docket = BeanDefinitionBuilder.genericBeanDefinition(SpringFoxDocket.class);
docket.addConstructorArgValue(group);
registry.registerBeanDefinition(group + "Docket", docket.getBeanDefinition());
}
}
示例5: assertMultipleAnnotationsWithIdenticalAttributeNames
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private void assertMultipleAnnotationsWithIdenticalAttributeNames(AnnotationMetadata metadata) {
AnnotationAttributes attributes1 = (AnnotationAttributes) metadata.getAnnotationAttributes(
NamedAnnotation1.class.getName(), false);
String name1 = attributes1.getString("name");
assertThat("name of NamedAnnotation1", name1, is("name 1"));
AnnotationAttributes attributes2 = (AnnotationAttributes) metadata.getAnnotationAttributes(
NamedAnnotation2.class.getName(), false);
String name2 = attributes2.getString("name");
assertThat("name of NamedAnnotation2", name2, is("name 2"));
AnnotationAttributes attributes3 = (AnnotationAttributes) metadata.getAnnotationAttributes(
NamedAnnotation3.class.getName(), false);
String name3 = attributes3.getString("name");
assertThat("name of NamedAnnotation3", name3, is("name 3"));
}
示例6: 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"));
}
示例7: setImportMetadata
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableRedissonHttpSession.class.getName());
AnnotationAttributes attrs = AnnotationAttributes.fromMap(map);
keyPrefix = attrs.getString("keyPrefix");
maxInactiveIntervalInSeconds = attrs.getNumber("maxInactiveIntervalInSeconds");
}
示例8: AbstractTemplateProvider
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
public AbstractTemplateProvider(AnnotationAttributes attributes) {
Assert.notNull(attributes, "AnnotationAttributes must not be null!");
this.excludeClasses = attributes.getClassArray(getExcludeClasses());
this.postfix = attributes.getString(getPostfix());
this.debug = attributes.getBoolean("debug");
this.overwrite = attributes.getBoolean("overwrite");
if (excludeClasses.length > 0 && debug) {
SDLogger.debug(String.format("Exclude %s %s in the %s generator", excludeClasses.length, excludeClasses.length == 1 ? "entity":"entities", postfix));
}
}
示例9: initialize
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
protected void initialize(AnnotationAttributes attributes, AppstatusConfigBuilder builder) {
this.configuration = builder.set("batch.logInterval", "logInterval")
.set("batch.zombieInterval", "zombieInterval")
.build();
this.tableName = attributes.getString("tableName");
this.daoClass = attributes.getClass("batchDaoClass");
}
示例10: setImportMetadata
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
public void setImportMetadata(AnnotationMetadata importMetadata) {
AnnotationAttributes attributes = AnnotationAttributes.fromMap(
importMetadata.getAnnotationAttributes(EnableMongoHttpSession.class.getName()));
this.maxInactiveIntervalInSeconds = attributes.getNumber("maxInactiveIntervalInSeconds");
String collectionNameValue = attributes.getString("collectionName");
if (StringUtils.hasText(collectionNameValue)) {
this.collectionName = this.embeddedValueResolver.resolveStringValue(collectionNameValue);
}
}
开发者ID:spring-projects,项目名称:spring-session-data-mongodb,代码行数:13,代码来源:MongoHttpSessionConfiguration.java
示例11: setImportMetadata
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
AnnotationAttributes attributes = AnnotationAttributes.fromMap(
importMetadata.getAnnotationAttributes(EnableMongoWebSession.class.getName()));
this.maxInactiveIntervalInSeconds = attributes.getNumber("maxInactiveIntervalInSeconds");
String collectionNameValue = attributes.getString("collectionName");
if (StringUtils.hasText(collectionNameValue)) {
this.collectionName = this.embeddedValueResolver.resolveStringValue(collectionNameValue);
}
}
开发者ID:spring-projects,项目名称:spring-session-data-mongodb,代码行数:15,代码来源:ReactiveMongoWebSessionConfiguration.java
示例12: 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");
}
示例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());
}
示例14: setImportMetadata
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
AnnotationAttributes attributes = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(EnableSpringSeedRedis.class.getName()));
this.defaultExpiration = attributes.getNumber("defaultExpiration").longValue();
this.propertyPrefix = attributes.getString("propertyPrefix");
AnnotationAttributes[] annotationAttributes = attributes.getAnnotationArray("cacheExpirations");
for(AnnotationAttributes a: annotationAttributes){
expiresMap.put(a.getString("value"), a.getNumber("expiration").longValue());
}
this.clearBeforeStart = attributes.getBoolean("clearBeforeStart");
}
示例15: MyBatisConfigurationBuilder
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private MyBatisConfigurationBuilder(AnnotationMetadata metadata) {
this.metadata = metadata;
AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(EnableMyBatis.class.getName(), false));
Assert.notNull(attributes, String.format("@%s is not present on importing class '%s' as expected", EnableMyBatis.class.getName(), metadata.getClassName()));
this.attributes = attributes;
this.useFlyway = attributes.getBoolean(Constant.USE_FLYWAY_ATTRIBUTE_NAME);
this.migration = attributes.getString(Constant.MIGRATION_ATTRIBUTE_NAME);
}