Search in sources :

Example 21 with AnnotationAttributes

use of org.springframework.core.annotation.AnnotationAttributes in project spring-boot by spring-projects.

the class ManagementContextConfigurationTests method proxyBeanMethodsCanBeDisabled.

@Test
void proxyBeanMethodsCanBeDisabled() {
    AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(NoBeanMethodProxyingManagementContextConfiguration.class, Configuration.class);
    assertThat(attributes.get("proxyBeanMethods")).isEqualTo(false);
}
Also used : AnnotationAttributes(org.springframework.core.annotation.AnnotationAttributes) Test(org.junit.jupiter.api.Test)

Example 22 with AnnotationAttributes

use of org.springframework.core.annotation.AnnotationAttributes in project spring-boot by spring-projects.

the class ManagementContextConfigurationTests method proxyBeanMethodsIsEnabledByDefault.

@Test
void proxyBeanMethodsIsEnabledByDefault() {
    AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(DefaultManagementContextConfiguration.class, Configuration.class);
    assertThat(attributes.get("proxyBeanMethods")).isEqualTo(true);
}
Also used : AnnotationAttributes(org.springframework.core.annotation.AnnotationAttributes) Test(org.junit.jupiter.api.Test)

Example 23 with AnnotationAttributes

use of org.springframework.core.annotation.AnnotationAttributes in project spring-boot by spring-projects.

the class OnEndpointElementCondition method getMatchOutcome.

@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
    AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(this.annotationType.getName()));
    String endpointName = annotationAttributes.getString("value");
    ConditionOutcome outcome = getEndpointOutcome(context, endpointName);
    if (outcome != null) {
        return outcome;
    }
    return getDefaultOutcome(context, annotationAttributes);
}
Also used : AnnotationAttributes(org.springframework.core.annotation.AnnotationAttributes) ConditionOutcome(org.springframework.boot.autoconfigure.condition.ConditionOutcome)

Example 24 with AnnotationAttributes

use of org.springframework.core.annotation.AnnotationAttributes in project spring-boot by spring-projects.

the class TestAutoConfigurationPackageRegistrar method registerBeanDefinitions.

@Override
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
    AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(TestAutoConfigurationPackage.class.getName(), true));
    AutoConfigurationPackages.register(registry, ClassUtils.getPackageName(attributes.getString("value")));
}
Also used : AnnotationAttributes(org.springframework.core.annotation.AnnotationAttributes)

Example 25 with AnnotationAttributes

use of org.springframework.core.annotation.AnnotationAttributes in project spring-boot by spring-projects.

the class OnPropertyCondition method getMatchOutcome.

@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
    List<AnnotationAttributes> allAnnotationAttributes = annotationAttributesFromMultiValueMap(metadata.getAllAnnotationAttributes(ConditionalOnProperty.class.getName()));
    List<ConditionMessage> noMatch = new ArrayList<>();
    List<ConditionMessage> match = new ArrayList<>();
    for (AnnotationAttributes annotationAttributes : allAnnotationAttributes) {
        ConditionOutcome outcome = determineOutcome(annotationAttributes, context.getEnvironment());
        (outcome.isMatch() ? match : noMatch).add(outcome.getConditionMessage());
    }
    if (!noMatch.isEmpty()) {
        return ConditionOutcome.noMatch(ConditionMessage.of(noMatch));
    }
    return ConditionOutcome.match(ConditionMessage.of(match));
}
Also used : AnnotationAttributes(org.springframework.core.annotation.AnnotationAttributes) ArrayList(java.util.ArrayList)

Aggregations

AnnotationAttributes (org.springframework.core.annotation.AnnotationAttributes)90 Test (org.junit.jupiter.api.Test)17 ArrayList (java.util.ArrayList)8 LinkedHashSet (java.util.LinkedHashSet)7 AnnotationMetadata (org.springframework.core.type.AnnotationMetadata)7 Annotation (java.lang.annotation.Annotation)6 Method (java.lang.reflect.Method)6 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)3 Map (java.util.Map)3 AnnotatedBeanDefinition (org.springframework.beans.factory.annotation.AnnotatedBeanDefinition)3 ConditionOutcome (org.springframework.boot.autoconfigure.condition.ConditionOutcome)3 StandardAnnotationMetadata (org.springframework.core.type.StandardAnnotationMetadata)3 PropertySourcesProcessor (com.ctrip.framework.apollo.spring.config.PropertySourcesProcessor)2 SpringValueDefinitionProcessor (com.ctrip.framework.apollo.spring.property.SpringValueDefinitionProcessor)2 DubboReference (org.apache.dubbo.config.annotation.DubboReference)2 ReferenceBean (org.apache.dubbo.config.spring.ReferenceBean)2 Test (org.junit.Test)2 AbstractBeanDefinition (org.springframework.beans.factory.support.AbstractBeanDefinition)2 BeanNameGenerator (org.springframework.beans.factory.support.BeanNameGenerator)2