Newsletter |
Quick Steps To Developing Spring Applications – Don’t Miss
Spring » on Aug 5, 2011 { 37 Comments } By Sivateja
We will see the steps to be follow for developing any spring application, these are core level read carefully.
- Spring environment starts by loading spring configuration xml file into Resource Interface object, we call this loading process as bootstrapping (technically) of spring framework.
- Resource is an interface and ClassPathResource is an implemented class given by spring, both are given in org.springframework.core.io. *
Syntax
Resource res = new ClassPathResource(“Our Config xml file name”);
- Actually this configuration file contains all bean configurations about our application [ some thing like struts.xml in struts 2 ]
- Next step is to bring spring IOC container into our program, it will be created by reading configuration xml through Resource object. Spring IOC container is called BeanFactory and this container is responsible for creating the bean objects and for injecting it’s dependencies through out our applications.
- BeanFactory is the interface and XmlBeanFactory is an implementation class of it, BeanFactory given in org.springframework.beans.factory. * and XmlBeanFactory is given in org.springframework.beans.factory.xml.* pack
Syntax
BeanFactory factory = new XmlBeanFactory(res);
// given above Resource object…
Now you can get required object from spring container by calling getBean() method, while calling this method we need to pass the bean id as a parameter like.. getBean(bean id), and this method always returns Object class object and we need to type caste this into our bean type.
Syntax
Object ob = factory.getBean(“id1”);
FirstBean fb = (FirstBean)ob;
Now you can call what ever you want from the object fb.
You Might Also Like
::. About the Author .:: | ||
Comments
37 Responses to “Quick Steps To Developing Spring Applications – Don’t Miss”
No words are enough to appreciate 🙂 🙂
@Abhishek
Thank you 🙂
Thanks…
really great tutorials.. no words to say..
Great explanation!!!
Really great tutorials till now…………….!
Really an Awsm tutorial i ever seen…!!
nice explanation… Very helpful to the beginners like me.
good explanation…
Nice Explanation… Very much helpful for beginners.. keep it up.
Thank you very much Sivateja Kandula.
really… what a nice explanation. i knew lots of concepts…
Very good self Explanatory.
Thanks for providing such a valuble content.
Keep it up.
really great tutorials….Thank you very much
Nice Explanation… Very much helpful for beginners..
This is what I was looking for. A very clean and sharp explanation.
Thanks a lot.
Hi Sir i just started reading your tutorials and i felt very happy because i understand everything wat ever you explainned…………….
Simple and very good explanation… Thank you so much
Very understandable to a junior developer… Thanks
Very Good Explanation…
thank u sir,for spring explanation in simple words
very nice explanation.It really helps me to understand the concept of spring.
good explanation for beginers..
very nice explanation.It really helps me to understand the concept of spring.
Very good explanation thanks a lot…its very helpful for beginners
GRATE JOB…!!
Nice explaination
Nice, Quick understanding
Thanks for sharing your knowledge
sir u helped to students like god……..
very nice sir………….
I have no words..really very well explained.Thanks a lot..
I have no words..
Very well explained..Thanks a lot sir.
Simple and very good explanation
Quick understanding… Thank you so much
This is great. Easy to understand
Nice explanation……….great work
Simply… Great work !!
Thanks a lot to the entire team.
Simple and well explained..
Thanks