View Full Version : Confused newbie ask for your help
Oct 15th, 2004, 06:56 PM
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 :?
Oct 16th, 2004, 12:51 AM
<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.
Oct 20th, 2004, 08:11 PM
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).
Oct 22nd, 2004, 03:07 PM
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.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.