Polishing
This commit is contained in:
parent
a1efe3cfe5
commit
43cb1af26a
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -57,9 +57,9 @@ public class AutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
|
|||
@Override
|
||||
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
|
||||
boolean candidateFound = false;
|
||||
Set<String> annoTypes = importingClassMetadata.getAnnotationTypes();
|
||||
for (String annoType : annoTypes) {
|
||||
AnnotationAttributes candidate = AnnotationConfigUtils.attributesFor(importingClassMetadata, annoType);
|
||||
Set<String> annTypes = importingClassMetadata.getAnnotationTypes();
|
||||
for (String annType : annTypes) {
|
||||
AnnotationAttributes candidate = AnnotationConfigUtils.attributesFor(importingClassMetadata, annType);
|
||||
if (candidate == null) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -360,8 +360,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
|
|||
|
||||
/**
|
||||
* Register a bean from the given bean class, optionally customizing its
|
||||
* bean definition metadata (typically declared as a lambda expression
|
||||
* or method reference).
|
||||
* bean definition metadata (typically declared as a lambda expression).
|
||||
* @param beanClass the class of the bean (resolving a public constructor
|
||||
* to be autowired, possibly simply the default constructor)
|
||||
* @param customizers one or more callbacks for customizing the factory's
|
||||
|
|
@ -374,10 +373,8 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
|
|||
}
|
||||
|
||||
/**
|
||||
* Register a bean from the given bean class, using the given supplier for
|
||||
* obtaining a new instance (typically declared as a lambda expression or
|
||||
* method reference), optionally customizing its bean definition metadata
|
||||
* (again typically declared as a lambda expression or method reference).
|
||||
* Register a bean from the given bean class, optionally customizing its
|
||||
* bean definition metadata (typically declared as a lambda expression).
|
||||
* @param beanName the name of the bean (may be {@code null})
|
||||
* @param beanClass the class of the bean (resolving a public constructor
|
||||
* to be autowired, possibly simply the default constructor)
|
||||
|
|
@ -396,7 +393,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
|
|||
* Register a bean from the given bean class, using the given supplier for
|
||||
* obtaining a new instance (typically declared as a lambda expression or
|
||||
* method reference), optionally customizing its bean definition metadata
|
||||
* (again typically declared as a lambda expression or method reference).
|
||||
* (again typically declared as a lambda expression).
|
||||
* @param beanClass the class of the bean
|
||||
* @param supplier a callback for creating an instance of the bean
|
||||
* @param customizers one or more callbacks for customizing the factory's
|
||||
|
|
@ -414,7 +411,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
|
|||
* Register a bean from the given bean class, using the given supplier for
|
||||
* obtaining a new instance (typically declared as a lambda expression or
|
||||
* method reference), optionally customizing its bean definition metadata
|
||||
* (again typically declared as a lambda expression or method reference).
|
||||
* (again typically declared as a lambda expression).
|
||||
* <p>This method can be overridden to adapt the registration mechanism for
|
||||
* all {@code registerBean} methods (since they all delegate to this one).
|
||||
* @param beanName the name of the bean (may be {@code null})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -205,19 +205,13 @@ public class AnnotationMetadataTests {
|
|||
assertThat("length of basePackageClasses[]", basePackageClasses.length, is(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* https://jira.spring.io/browse/SPR-11649
|
||||
*/
|
||||
@Test
|
||||
@Test // SPR-11649
|
||||
public void multipleAnnotationsWithIdenticalAttributeNamesUsingStandardAnnotationMetadata() {
|
||||
AnnotationMetadata metadata = new StandardAnnotationMetadata(NamedAnnotationsClass.class);
|
||||
assertMultipleAnnotationsWithIdenticalAttributeNames(metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* https://jira.spring.io/browse/SPR-11649
|
||||
*/
|
||||
@Test
|
||||
@Test // SPR-11649
|
||||
public void multipleAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor() throws Exception {
|
||||
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
|
||||
MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(NamedAnnotationsClass.class.getName());
|
||||
|
|
@ -225,19 +219,13 @@ public class AnnotationMetadataTests {
|
|||
assertMultipleAnnotationsWithIdenticalAttributeNames(metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* https://jira.spring.io/browse/SPR-11649
|
||||
*/
|
||||
@Test
|
||||
@Test // SPR-11649
|
||||
public void composedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsingStandardAnnotationMetadata() {
|
||||
AnnotationMetadata metadata = new StandardAnnotationMetadata(NamedComposedAnnotationClass.class);
|
||||
assertMultipleAnnotationsWithIdenticalAttributeNames(metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* https://jira.spring.io/browse/SPR-11649
|
||||
*/
|
||||
@Test
|
||||
@Test // SPR-11649
|
||||
public void composedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor() throws Exception {
|
||||
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
|
||||
MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(NamedComposedAnnotationClass.class.getName());
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[-[null-safety]]
|
||||
[[null-safety]]
|
||||
= Null-safety
|
||||
|
||||
Although Java does not let you express null-safety with its type system, the Spring Framework
|
||||
|
|
|
|||
Loading…
Reference in New Issue