Nandeesh Satishkumar

Greenhorn
+ Follow
since Sep 30, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nandeesh Satishkumar

My understanding is...
In case of a web application one can use the contextLoaderListener to load the spring configuration files. I would prefer this approach as spring does the job for me of creating the Application context. So in this example below...

<!--------- In Web.xml ----------->


ContextLoaderListener will look for the param contextConfigLocation and load the configuration files used in the value, in this case applicationContext1. So if later I want to change the path of my applicationContext1.xml I can do it here with out any re-compilation of code required. So internally appContext is created by spring for me.

One has to get hands on to this context to extract the beans of the applicationContext1.xml. One way I think this can be acheived is the use of ApplicationContextAware interface. An example of this usage is given here http://jerlinworld.wordpress.com/2009/07/20/making-your-spring-application-context-aware/. Once access to the context is available one can created a Factory class and using the getBean method on the context beans can be extraceted from applicationContext1.xml.

The usage of getBean is the required glue code between spring and your application. DI is just a concept of injecting resources in to bean so that the bean is avaialble ready to use out of the box.


13 years ago