Loading... Cancel

Wow, new configuration option on Spring 2.0 R

December 8th, 2006

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;
}
}

Total 0 response found

Close