Created
October 10, 2017 14:30
-
-
Save NoUsername/9e4f50892d89ebb781fb8200c7db7390 to your computer and use it in GitHub Desktop.
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
// AI.java | |
public interface AI | |
{ | |
String getName(); | |
} | |
// A.java | |
@Service | |
public class A implements AI | |
{ | |
@Override | |
public String getName() | |
{ | |
return "a"; | |
} | |
} | |
// AO.java | |
@Service | |
public class AO implements AI | |
{ | |
final String name; | |
public AOne(String name) | |
{ | |
this.name = name; | |
} | |
public AOne() | |
{ | |
this("DEFAULT"); | |
} | |
@Override | |
public String getName() | |
{ | |
return name; | |
} | |
} | |
// B.java | |
@Service | |
public class B | |
{ | |
@Autowired | |
private AI a; | |
@PostConstruct | |
public void init() | |
{ | |
System.out.println("a is: " + a.getName()); | |
} | |
} | |
// you will always get "a is: a" although it should be a duplicate bean definition error | |
// tested with Spring v1.4.2.RELEASE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment