Skip to content

Commit 0c0d23d

Browse files
committed
Polishing
1 parent a31ebb6 commit 0c0d23d

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/ReplaceOverride.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,22 @@ public void addTypeIdentifier(String identifier) {
6969
this.typeIdentifiers.add(identifier);
7070
}
7171

72-
7372
@Override
7473
public boolean matches(Method method) {
75-
// TODO could cache result for efficiency
7674
if (!method.getName().equals(getMethodName())) {
77-
// It can't match.
7875
return false;
7976
}
80-
8177
if (!isOverloaded()) {
82-
// No overloaded: don't worry about arg type matching.
78+
// Not overloaded: don't worry about arg type matching...
8379
return true;
8480
}
85-
86-
// If we get to here, we need to insist on precise argument matching.
81+
// If we get here, we need to insist on precise argument matching...
8782
if (this.typeIdentifiers.size() != method.getParameterTypes().length) {
8883
return false;
8984
}
9085
for (int i = 0; i < this.typeIdentifiers.size(); i++) {
9186
String identifier = this.typeIdentifiers.get(i);
9287
if (!method.getParameterTypes()[i].getName().contains(identifier)) {
93-
// This parameter cannot match.
9488
return false;
9589
}
9690
}

spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ String aString() {
250250
return "regular";
251251
}
252252

253-
@Bean
253+
@Bean @Lazy
254254
String aString(Integer dependency) {
255255
return "overloaded" + dependency;
256256
}

0 commit comments

Comments
 (0)