• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt in initApplicationContext() method

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends,

I am new in Spring framework. I am making one small application using AbstractController. When i was reading about AbstractController i came across initApplicationContext() method. I tried to search lot of thing but i am not able to digest the concept of this method.

So here can anybody Please tell me the use of this method and how to call it into the implementation class.


Thanks in advance.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
initApplicationContext() will be called by Spring, you don't need to worry about that method. If you override it for any particular reason, you'd better call super.initApplicationContext() in your implementation.
When using an AbstractController, you only have to override the handleRequestInternal(HttpServletRequest, HttpServletResponse) method.
[ September 10, 2007: Message edited by: Christophe Verre ]
 
Rajesh Rathod
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Christophe,

Thanks for your answer.

My doubt is that when i put System.out.println() inside this method initApplicationContext() method it was not printed. So my question is when this method will be invoked while application is run.

Thanks.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This method is called by setApplicationContext, which is called by Spring, when it sets the ApplicationContext to the controller. But if the controller is not running in an application context, I don't think that setApplicationContext will be called at all.
I don't remember how web applications treat the application context, but there's a reference here which might help you.
 
Rajesh Rathod
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your help.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic