Newsletter

Quick Steps To Developing Spring Applications – Don’t Miss

Spring » on Aug 5, 2011 { 36 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 .::

Java4s_Author
- Java/J2EE Full Stack Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.

Comments

36 Responses to “Quick Steps To Developing Spring Applications – Don’t Miss”
  1. Abhishek says:

    No words are enough to appreciate 🙂 🙂

  2. Java4s says:

    @Abhishek

    Thank you 🙂

  3. Shital says:

    Thanks…

  4. sai says:

    really great tutorials.. no words to say..

  5. jitendra singh says:

    Really great tutorials till now…………….!

  6. Sonu says:

    Really an Awsm tutorial i ever seen…!!

  7. kirthika says:

    nice explanation… Very helpful to the beginners like me.

  8. ravikiran says:

    good explanation…

  9. Kishor says:

    Nice Explanation… Very much helpful for beginners.. keep it up.

    Thank you very much Sivateja Kandula.

  10. Trilochan Tarai says:

    really… what a nice explanation. i knew lots of concepts…

  11. Korivi says:

    Very good self Explanatory.
    Thanks for providing such a valuble content.
    Keep it up.

  12. ramu says:

    really great tutorials….Thank you very much

  13. praveen kumar says:

    Nice Explanation… Very much helpful for beginners..

  14. Supriyo Das says:

    This is what I was looking for. A very clean and sharp explanation.
    Thanks a lot.

  15. Anil says:

    Hi Sir i just started reading your tutorials and i felt very happy because i understand everything wat ever you explainned…………….

  16. hemanth says:

    Simple and very good explanation… Thank you so much

  17. sarronya says:

    Very understandable to a junior developer… Thanks

  18. Sachin says:

    Very Good Explanation…

  19. akki says:

    thank u sir,for spring explanation in simple words

  20. Rajesh says:

    very nice explanation.It really helps me to understand the concept of spring.

  21. Somu says:

    good explanation for beginers..

  22. koti says:

    very nice explanation.It really helps me to understand the concept of spring.

  23. sarala says:

    Very good explanation thanks a lot…its very helpful for beginners

  24. Ishwar says:

    Nice explaination

  25. Nageshwar says:

    Nice, Quick understanding

  26. Swamy says:

    Thanks for sharing your knowledge

  27. sreenu says:

    sir u helped to students like god……..

  28. sreenivas says:

    very nice sir………….

  29. Anup says:

    I have no words..really very well explained.Thanks a lot..

  30. Anup says:

    I have no words..
    Very well explained..Thanks a lot sir.

  31. Venkat says:

    Simple and very good explanation
    Quick understanding… Thank you so much

  32. alphonse says:

    This is great. Easy to understand

  33. Roopashree says:

    Nice explanation……….great work

  34. Pintu Gupta says:

    Simply… Great work !!

    Thanks a lot to the entire team.

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
Most Recent Posts from Top Categories
Spring Boot Hibernate Spring
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2018 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.