Announcement Announcement Module
Collapse
No announcement yet.
Confused newbie ask for your help Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Confused newbie ask for your help

    i'm new to Spring, trying to learn via Spring Reference. I had used xml definitions before in Struts, or in my own SmartServlet implementation framework. But Spring.. maybe i miss something that's just behind me. but i cannot understand what these <beans> tags are for.. how are things going in a Spring app. We write beans in a Java code, then write them again into xml. what is xml doing anyway. we already wrote them into java. u see, i just miss the picture. any help on basics of spring or lifecycles or framework flow will be most appreciated.

    let me be into the Spring world :?

  • #2
    The
    <beans>
    allow Spring to manage your classes using IoC and AOP. I'd search the web for more info. on those topics if you are unfamiliar with them ("J2EE Development without EJB" is a good book read covering these topics).

    When the application context is loaded Spring will instantiate the class, inject dependencies and wrap them with interecptors as you define.

    Comment


    • #3
      Akad, have a read of http://www.martinfowler.com/articles/injection.html. The xml removes the need for most of the glue code used to wire up your apps. I would also suggest checking out Rod and Juergen's book, J2EE Development without EJB (Chapter 6 Covers Inversion of Control).

      Have fun.

      Comment


      • #4
        thanx a lot.. i think i get the idea.. i wanna write down what i get in order to both verify if i am true and to help other newbies who suffer the same:

        think of polymorphism: we have a base class and inherited ones. we can handle all inherited ones and base one by using a pointer to base class. that works when we don't know which object will be created at run time. but there is a break-point here: we are also the one who writes client code. so actually creation of objects are indeed hard-coded and hard to change. but in spring, we say: "when i need MyBaseClazz in App1, create inherited1Clazz, in App2, create inherited2Clazz, so on" but we say that not programmaticaly, but by xml codes. spring framework creates and returns actual objects for us to deal with.

        am i right, if not please correct me.

        Comment

        Working...
        X