Skip to content

Instantly share code, notes, and snippets.

@keesun
Created January 18, 2012 13:57
Show Gist options
  • Save keesun/1633111 to your computer and use it in GitHub Desktop.
Save keesun/1633111 to your computer and use it in GitHub Desktop.
Spring 3.1's extends @configuration
@Configuration
public class AppConfig extends HelloConfig {
@Override
public Hello hello() {
Hello h = super.hello();
h.setName("Keesun");
return h;
}
}
public class Hello {
String name;
public void setName(String name) {
this.name = name;
}
public void sayHello() {
System.out.println("Hello " + name);
}
}
@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