本文整理汇总了Java中org.springframework.core.annotation.AnnotationAttributes.getStringArray方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationAttributes.getStringArray方法的具体用法?Java AnnotationAttributes.getStringArray怎么用?Java AnnotationAttributes.getStringArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.annotation.AnnotationAttributes
的用法示例。
在下文中一共展示了AnnotationAttributes.getStringArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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());
}
}
示例3: 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;
}
示例4: 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
示例5: getBasePackages
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
public static String[] getBasePackages(AnnotationAttributes attributes, String[] defaultPackages) {
String[] value = attributes.getStringArray("value");
String[] basePackages = attributes.getStringArray(BASE_PACKAGES);
Class<?>[] basePackageClasses = attributes.getClassArray(BASE_PACKAGE_CLASSES);
// Default configuration - return package of annotated class
if (value.length == 0 && basePackages.length == 0 && basePackageClasses.length == 0) {
return defaultPackages;
}
Set<String> packages = new HashSet<String>();
packages.addAll(Arrays.asList(value));
packages.addAll(Arrays.asList(basePackages));
for (Class<?> typeName : basePackageClasses) {
packages.add(ClassUtils.getPackageName(typeName));
}
return packages.toArray(new String[] {});
}
示例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[] 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
示例7: 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
示例8: getPackagesToScan
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private static Set<String> getPackagesToScan(AnnotationAttributes attributes) {
String[] basePackages = attributes.getStringArray("basePackages");
Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses");
Set<String> packagesToScan = new LinkedHashSet<>();
packagesToScan.addAll(Arrays.asList(basePackages));
for (Class<?> basePackageClass : basePackageClasses) {
packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
}
return packagesToScan;
}
示例9: parsePatterns
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private Set<Pattern> parsePatterns(AnnotationMetadata annotation, String attributeName) {
Set<Pattern> result = new HashSet<Pattern>();
AnnotationAttributes attributes = new AnnotationAttributes(
annotation.getAnnotationAttributes(GuiceModule.class.getName()));
String[] filters = attributes.getStringArray(attributeName);
for (String filter : filters) {
result.add(Pattern.compile(filter));
}
return result;
}
示例10: getMatchOutcome
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(
metadata.getAnnotationAttributes(ConditionalOnJndi.class.getName()));
String[] locations = annotationAttributes.getStringArray("value");
try {
return getMatchOutcome(locations);
}
catch (NoClassDefFoundError ex) {
return ConditionOutcome.noMatch("JNDI class not found");
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:OnJndiCondition.java
示例11: getPatterns
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private String[] getPatterns(AnnotationAttributes filterAttributes) {
try {
return filterAttributes.getStringArray("pattern");
} catch (IllegalArgumentException o_O) {
return new String[0];
}
}
示例12: registerBeanDefinitions
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry beanDefinitionRegistry) {
AnnotationAttributes attributes = AnnotationAttributes.fromMap(annotationMetadata.getAnnotationAttributes(EnableRedis.class.getName(), false));
String[] names = attributes.getStringArray(DATASOURCE_NAME_ATTRIBUTE_NAME);
for (String name : names) {
if (beanDefinitionRegistry.containsBeanDefinition(name)) {
continue;
}
beanDefinitionRegistry.registerBeanDefinition(name, new RedisDataSourceBeanDefinitionFactory(name).build());
}
}
示例13: assertMetaAnnotationOverrides
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
private void assertMetaAnnotationOverrides(AnnotationMetadata metadata) {
AnnotationAttributes attributes = (AnnotationAttributes) metadata.getAnnotationAttributes(
TestComponentScan.class.getName(), false);
String[] basePackages = attributes.getStringArray("basePackages");
assertThat("length of basePackages[]", basePackages.length, is(1));
assertThat("basePackages[0]", basePackages[0], is("org.example.componentscan"));
String[] value = attributes.getStringArray("value");
assertThat("length of value[]", value.length, is(0));
Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses");
assertThat("length of basePackageClasses[]", basePackageClasses.length, is(0));
}
示例14: getPackagesToScan
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
/**
* Inspects the packages to be scanned for {@link RetrofitService} interfaces from the {@link RetrofitServiceScan}
* import annotation.
*
* @param metadata the annotation metadata.
* @return a set of packages to be scanned for {@link RetrofitService} candidates.
*/
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
AnnotationAttributes attributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(RetrofitServiceScan.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),
"@RetrofitServiceScan 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:troinine,项目名称:spring-boot-square-oss-support,代码行数:35,代码来源:RetrofitServiceFactoryBeanRegistrar.java
示例15: initialize
import org.springframework.core.annotation.AnnotationAttributes; //导入方法依赖的package包/类
@Override
protected void initialize(AnnotationAttributes attributes, AppstatusConfigBuilder configBuilder) {
this.urlMappings = attributes.getStringArray("urlMappings");
}