Wow, new configuration option on Spring 2.0

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

my tweets

December 2006
S S M T W T F
« Nov   Jan »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Flickr Photos

RSS my shared links on google reader

  • An error has occurred; the feed is probably down. Try again later.
%d bloggers like this: