forked from spring-projects/spring-framework
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed Overloaded @bean method causes bean to be created twice and oth…
…er bean not to be created spring-projects#25263
- Loading branch information
wangguogang
committed
Jun 30, 2020
1 parent
f7dd1e3
commit 3665355
Showing
8 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
spring-context/src/test/java/org/springframework/context/annotation/foo/SomeBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.springframework.context.annotation.foo; | ||
|
||
public class SomeBean { | ||
private final SomeOtherBean other; | ||
|
||
public SomeBean(SomeOtherBean other) { | ||
this.other = other; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
spring-context/src/test/java/org/springframework/context/annotation/foo/SomeConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.springframework.context.annotation.foo; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
|
||
@Configuration | ||
public class SomeConfig { | ||
|
||
@Bean(name = "other") | ||
public SomeOtherBean foo() { | ||
System.out.println("constructing SomeOtherBean"); | ||
return new SomeOtherBean(); | ||
} | ||
|
||
@Bean(name = "foo") | ||
public SomeBean foo(@Autowired SomeOtherBean other) { | ||
System.out.println("constructing SomeBean"); | ||
return new SomeBean(other); | ||
} | ||
|
||
|
||
} |
6 changes: 6 additions & 0 deletions
6
spring-context/src/test/java/org/springframework/context/annotation/foo/SomeOtherBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.springframework.context.annotation.foo; | ||
|
||
public class SomeOtherBean { | ||
public SomeOtherBean() { | ||
} | ||
} |