Skip to content

Commit 967a05e

Browse files
committed
Polishing
1 parent 3bab2d8 commit 967a05e

File tree

7 files changed

+26
-24
lines changed

7 files changed

+26
-24
lines changed

spring-core/src/main/java/org/springframework/core/type/AnnotatedTypeMetadata.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ default MultiValueMap<String, Object> getAllAnnotationAttributes(
160160
* <p>Note: in contrast to {@link #getAllAnnotationAttributes(String)},
161161
* this method <em>does</em> take attribute overrides on composed annotations
162162
* into account.
163-
* @param annotationName the fully qualified class name of the annotation
163+
* @param annotationName the fully-qualified class name of the annotation
164164
* type to look for
165-
* @return a list of maps of attributes, with the attribute name as map key
166-
* (e.g. "key") and the attribute value as map value; never {@code null} but
167-
* potentially empty if no such annotations are found
165+
* @return a set of maps of attributes, with each annotation attribute name
166+
* as map key (e.g. "location") and the attribute's value as map value; never
167+
* {@code null} but potentially empty if no such annotations are found
168168
* @since 6.1
169169
* @see #getAllMergedAnnotationAttributes(String, boolean)
170170
*/
@@ -178,12 +178,14 @@ default Set<? extends Map<String, Object>> getAllMergedAnnotationAttributes(Stri
178178
* <p>Note: in contrast to {@link #getAllAnnotationAttributes(String, boolean)},
179179
* this method <em>does</em> take attribute overrides on composed annotations
180180
* into account.
181-
* @param annotationName the fully qualified class name of the annotation
181+
* @param annotationName the fully-qualified class name of the annotation
182182
* type to look for
183183
* @param classValuesAsString whether to convert class references to String
184-
* @return a list of maps of attributes, with the attribute name as map key
185-
* (e.g. "key") and the attribute value as map value; never {@code null} but
186-
* potentially empty if no such annotations are found
184+
* class names for exposure as values in the returned Map, instead of Class
185+
* references which might potentially have to be loaded first
186+
* @return a set of maps of attributes, with each annotation attribute name
187+
* as map key (e.g. "location") and the attribute's value as map value; never
188+
* {@code null} but potentially empty if no such annotations are found
187189
* @since 6.1
188190
* @see #getAllMergedAnnotationAttributes(String)
189191
*/

spring-test/src/test/java/org/springframework/test/gh30941/AppConfig.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import org.springframework.context.annotation.Configuration;
2020

2121
@Configuration
22-
@ConnectedToModuleA
23-
@ConnectedToModuleB
22+
@ScanPackageA
23+
@ScanPackageB
2424
@PropertySourceA
2525
@PropertySourceB
2626
class AppConfig {

spring-test/src/test/java/org/springframework/test/gh30941/ComponentScanAndPropertySourceTests.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@
2121
import org.springframework.beans.factory.annotation.Autowired;
2222
import org.springframework.core.env.Environment;
2323
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
24-
import org.springframework.test.gh30941.a.ModuleAClient;
25-
import org.springframework.test.gh30941.b.ModuleBClient;
24+
import org.springframework.test.gh30941.a.ComponentA;
25+
import org.springframework.test.gh30941.b.ComponentB;
2626

2727
import static org.assertj.core.api.Assertions.assertThat;
2828

2929
@SpringJUnitConfig(AppConfig.class)
3030
class ComponentScanAndPropertySourceTests {
3131

3232
@Autowired
33-
ModuleAClient clientA;
33+
ComponentA componentA;
3434

3535
@Autowired
36-
ModuleBClient clientB;
36+
ComponentB componentB;
3737

3838
@Autowired
3939
Environment env;
4040

4141
@Test
4242
void test() {
43-
assertThat(clientA).isNotNull();
44-
assertThat(clientB).isNotNull();
43+
assertThat(componentA).isNotNull();
44+
assertThat(componentB).isNotNull();
4545
assertThat(env.getProperty("A")).isEqualTo("apple");
4646
assertThat(env.getProperty("B")).isEqualTo("banana");
4747
}

spring-test/src/test/java/org/springframework/test/gh30941/ConnectedToModuleA.java renamed to spring-test/src/test/java/org/springframework/test/gh30941/ScanPackageA.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
import java.lang.annotation.Target;
2323

2424
import org.springframework.context.annotation.ComponentScan;
25-
import org.springframework.test.gh30941.a.ModuleAClient;
25+
import org.springframework.test.gh30941.a.ComponentA;
2626

2727
@Retention(RetentionPolicy.RUNTIME)
2828
@Target(ElementType.TYPE)
29-
@ComponentScan(basePackageClasses = ModuleAClient.class)
30-
@interface ConnectedToModuleA {
29+
@ComponentScan(basePackageClasses = ComponentA.class)
30+
@interface ScanPackageA {
3131
}

spring-test/src/test/java/org/springframework/test/gh30941/ConnectedToModuleB.java renamed to spring-test/src/test/java/org/springframework/test/gh30941/ScanPackageB.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
import java.lang.annotation.Target;
2323

2424
import org.springframework.context.annotation.ComponentScan;
25-
import org.springframework.test.gh30941.b.ModuleBClient;
25+
import org.springframework.test.gh30941.b.ComponentB;
2626

2727
@Retention(RetentionPolicy.RUNTIME)
2828
@Target(ElementType.TYPE)
29-
@ComponentScan(basePackageClasses = ModuleBClient.class)
30-
@interface ConnectedToModuleB {
29+
@ComponentScan(basePackageClasses = ComponentB.class)
30+
@interface ScanPackageB {
3131
}

spring-test/src/test/java/org/springframework/test/gh30941/a/ModuleAClient.java renamed to spring-test/src/test/java/org/springframework/test/gh30941/a/ComponentA.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
import org.springframework.stereotype.Component;
2020

2121
@Component
22-
public class ModuleAClient {
22+
public class ComponentA {
2323
}

spring-test/src/test/java/org/springframework/test/gh30941/b/ModuleBClient.java renamed to spring-test/src/test/java/org/springframework/test/gh30941/b/ComponentB.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
import org.springframework.stereotype.Component;
2020

2121
@Component
22-
public class ModuleBClient {
22+
public class ComponentB {
2323
}

0 commit comments

Comments
 (0)