Friday, July 27, 2007

Spring Tip #1: Application Context

Did you know that if your method needs access to the Application Context then all you need to do is implement a Spring interface "ApplicationContextAware" and override the setApplicationContext(...) method in your bean.

public void setApplicationContext(ApplicationContext applicationcontext)
throws BeansException {
ctx = applicationcontext;

Here is an sample example that shows you how to use it.

Also, if you want to listen to all events... then implement ApplicationListener interface and catch your events like this:

public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof SegmentEvent) {
final SegmentEvent segEvent = (SegmentEvent) event;

And now for some user feedback... :-)

Do you feel that there is not a very good Spring Book or reference that provides you with all the tips-n-tricks on how to harness Spring effectively?

Yes, the knowledge is out there in the Spring reference online and in those various sources but I haven't seen a good source of bite-sized book on Spring Tips...

When I asked around a few of you shared the same comment... Wouldn't it be great if there was a book/blog that gave you a daily Spring Tip with a short example...

If you share my thoughts, drop me a line and be counted...


Anonymous said...

Fine way of explaining, and fastidious post to take facts
on the topic of my presentation subject, which i am going to deliver in school.

Feel free to surf to my web page; green coffee

Anonymous said...

Oh my goodness! Impressive article dude! Thank you, However I am experiencing troubles with your RSS.
I don't understand why I am unable to join it. Is there anybody getting identical RSS issues? Anybody who knows the solution will you kindly respond? Thanx!!

My web-site ... Does Vimax Work

Anonymous said...

Hello! I could have sworn I've been to this web site before but after looking at some of the articles I realized it's new to me.

Nonetheless, I'm certainly pleased I discovered it and I'll be book-marking it and
checking back often!

Feel free to visit my homepage acai ultra lean reviews

Anonymous said...

I do not know if it's just me or if everyone else experiencing problems with your blog. It appears as though some of the text on your posts are running off the screen. Can somebody else please comment and let me know if this is happening to them as well? This might be a problem with my internet browser because I've
had this happen previously. Cheers

Feel free to visit my web site; what is garcinia cambogia

Anonymous said...

Hello, I do believe your site could be having web browser
compatibility problems. Whenever I take a look at your web site in Safari, it looks fine but when opening in Internet Explorer, it's got some overlapping issues. I merely wanted to provide you with a quick heads up! Apart from that, wonderful website!

My website - Buy Raspberry ketone Plus

Anonymous said...

Hey there! I'm at work browsing your blog from my new apple iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Keep up the fantastic work!

My website ... Wrinkle cream

Anonymous said...

Just wish to say your article is as amazing. The clarity in your
publish is just spectacular and that i could suppose you're a professional in this subject. Fine with your permission allow me to snatch your RSS feed to keep up to date with drawing close post. Thank you one million and please carry on the gratifying work.

my web-site; Stem Cell Wrinkle Cream

Anonymous said...

It's actually a great and useful piece of info. I am satisfied that you simply shared this helpful information with us. Please keep us up to date like this. Thanks for sharing.

my homepage - Ultra Slim Patch Weight Loss **

Anonymous said...

This is a topic that is close to my heart... Take care!

Exactly where are your contact details though?

Here is my homepage Natural Cleanse Diet

Anonymous said...

This site was... how do you say it? Relevant!

! Finally I've found something that helped me. Cheers!

Max Thermo Burn Muscle review

Anonymous said...

Thanks for the marvelous posting! I definitely enjoyed reading it, you may be a great author.

I will be sure to bookmark your blog and definitely will come
back someday. I want to encourage you to ultimately continue your great work, have a nice weekend!

Also visit my web site: Green coffee reviews

Anonymous said...

Yes! Finally someone writes about weight control.

corexin review

Anonymous said...

My spouse and I stumbled over here different page and thought I may as well check things out.

I like what I see so i am just following you. Look
forward to looking into your web page repeatedly.

Here is my web-site; make real money online (

Anonymous said...

It's fantastic that you are getting ideas from this paragraph as well as from our argument made at this place.

testosrong reviews

Anonymous said...

I am really happy to glance at this web site posts which carries lots of useful
facts, thanks for providing these information.

My webpage: ripped muscle x

Anonymous said...

This post is invaluable. When can I find out more?

Here is my website; Home Web Profits review\Home Web Profits reviews