Created
January 18, 2012 13:57
-
-
Save keesun/1633111 to your computer and use it in GitHub Desktop.
Spring 3.1's extends @configuration
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
@Configuration | |
public class AppConfig extends HelloConfig { | |
@Override | |
public Hello hello() { | |
Hello h = super.hello(); | |
h.setName("Keesun"); | |
return h; | |
} | |
} |
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
public class Hello { | |
String name; | |
public void setName(String name) { | |
this.name = name; | |
} | |
public void sayHello() { | |
System.out.println("Hello " + name); | |
} | |
} |
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
@Configuration | |
public class HelloConfig { | |
@Bean | |
public Hello hello() { | |
Hello h = new Hello(); | |
h.setName("Toby"); | |
return h; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment