hi today i found an interesting stuff..
Rod talked about new configuration option in spring (actually you can add as an addon) Define bean using Java code Wow!!!.. i was looking for this stuff for a long while… sometimes it is really meaningful to me…
here is code example for rod blog:
@Configuration
public class MyConfig {
@Bean
public Person rod() {
return new Person(“Rod Johnson”);
}@Bean(scope = Scope.PROTOTYPE)
public Book book() {
Book book = new Book(“Expert One-on-One J2EE Design and Development”);
book.setAuthor(rod()); // rod() method is actually a bean reference !
return book;
}
}
public class MyConfig {
@Bean
public Person rod() {
return new Person(“Rod Johnson”);
}@Bean(scope = Scope.PROTOTYPE)
public Book book() {
Book book = new Book(“Expert One-on-One J2EE Design and Development”);
book.setAuthor(rod()); // rod() method is actually a bean reference !
return book;
}
}
anyway here is details
http://blog.interface21.com/main/2006/11/28/a-java-configuration-option-for-spring/
http://blog.interface21.com/main/2006/11/28/a-java-configuration-option-for-spring/
Advertisement





Recent Comments