For a while, I’ve been intrigued by the growing popularity of the Spring Framework.
Like most, I had a surface understanding of its capabilities, but, recently I decided to delve deeper and actually write some code with it to learn a little more.
Spring comes with a mass of documentation and complete application samples, which is pretty good compared to some open source projects. However, it’s all a bit overwhelming for the novice who’s just walked in the door. Where do you start?
Well, I’ve persevered and cut through some of it. And, as a result I’ve compiled some very simple examples for the developer who’s never seen Spring before and wants to know where to start on day one.
I’ve bundled the code samples together with all their required dependencies into the following Spring Start - a getting started guide / tutorial for the Spring Framework. The whole thing has been tailored for use within the Eclipse IDE and takes almost no setup to get going. You should be able to step through code that uses Spring within minutes.
From the associated readme.txt:
Spring Start - “Where do I Start?” For Developers
David Caruana (david@caruana.co.uk)
11th Feb 2005 - Initial Revision
1. Introduction
This bundle provides a small set of code examples that demonstrate the core features of the Spring Framework (www.springframework.org).
You won’t find here a description of the Spring Framework or why you should use it - that is best left to the Spring developers (at their site and in resources such “J2EE Developement without EJB” by Rod Johnson).
However, you will find a collection of concise code examples that step you through the basic Spring capabilities. These samples were created during my first few days with Spring whilst trying to untangle the large amounts of documentation and complete sample applications. I hope that other developers who are also just starting out with Spring will find them useful.
I’ve concentrated on the heart of Spring to start with; Bean Factories and AOP. The samples execute stand-alone so there’s no need for a web or application container which means they’re really easy to get into. The amount of code to browse is the bare minimum.
This bundle is completely self encapsulated and includes all the required dependencies to get going. It was developed with Spring Framework 1.1.4.
I may continue to provide updated bundles in the future as I continue to learn Spring.
2. How to use this bundle?
This bundle is best used with the Eclipse IDE. Everything has been setup as an Eclipse Project and so the only step should be to import the Project:
a) Unzip the bundle to a file directory of your choice
b) Start Eclipse
c) File -> Import…
d) Select Existing Project into Workspace
e) Browse to your unzipped file directory of choice
f) Hit OK and Finish
g) The Project is now imported
At this point you can browse the source code which resides in the “src” directory or select Project | Build All to build everything.
3. Structure of the Samples
Within the “src” directory there are currently two top level packages:
ex01_bean - samples that demonstrate core Bean Factory capability
ex02_aop - samples that demonstrate core AOP capability
Within each top level package, you’ll find a sample sub-package which is typically self-contained. Each sample contains a Main.java.
Within Eclipse, you can right-click the Main.java to Run it or Debug it (more useful when learning) to step through the code or set breakpoints.
The ex01_bean package is commented, however, the ex02_aop package has yet to be commented, but the samples are still simple enough.
4. References Used
J2EE development without EJB - Rod Johnson
Spring Framework 1.1.4 Reference Guide
Spring Application Samples that come with Spring 1.1.4
5. Feedback
I’m not an expert on Spring (I’ve spent 3 days with it so far), so if you find any mistakes or can suggest improvements, please get in contact (david@caruana.co.uk).
6. Disclaimer
The enclosed examples are provided for tutorial purposes only.
Brian Hlabioa | 18-Feb-05 at 11:50 am | Permalink
Thanx for the Spring Start files. It really makes a huge difference in terms of making it easier to learn Spring.
Nirav Thaker | 21-Feb-05 at 11:03 am | Permalink
Good work David, I appreciate your efforts, it helped in uderstanding the concret impl.
Rekha Jayaram | 16-May-05 at 5:03 pm | Permalink
Thanks a lot for thaking the time to compile this article. It was very helpful
Yassin Sibai | 14-Jun-05 at 9:56 pm | Permalink
Thank you for the SpringStart package. It did help understand the basics.
Deepak | 07-Sep-05 at 7:11 am | Permalink
Its very good to start learning.
Project didn’t work straightaway as I had to import xerces.jar also.
You may wanna include that too.
Alvaro Egana | 13-Sep-05 at 5:44 pm | Permalink
Great work David!. Thanks a lot for spending your time writing this article to Spring newbies (like me).
Dhivya | 11-Dec-05 at 10:31 am | Permalink
Hi David,
Excellent work. your example code helped me a lot in understanding spring,much faster.
Keep it up.
Thanks,
Dhivya
Arie | 04-Jan-06 at 8:27 am | Permalink
David,
Great work !! It is very useful in getting started with Spring. It’s concise and very well written.
Cheers,
Arie
Rajesh | 24-Mar-06 at 3:14 am | Permalink
David,
Fantastic starting work.Helps a lot.
Thanks,
rajesh
Alex | 05-Apr-06 at 9:24 am | Permalink
Hi David,
Great work. You might also be interested in AppFuse (https://appfuse.dev.java.net/) - I used this in conjunction with your app. There’s an article about it here: http://today.java.net/pub/a/today/2004/07/15/thefuse.html.
Again - thx for this post.
Alex
Bharat | 09-May-06 at 10:48 am | Permalink
Excellent work for newbies.
Shailendra | 25-May-06 at 9:37 am | Permalink
Hi David..
Your example rocks..
Excellent work!!!
K.V. RAMANA RAO | 02-Aug-06 at 4:32 pm | Permalink
Hi David,
Really very simple & useful examples for the beginners. These examples
will give an overall idea about IOC,DI and AOP concepts.
A great work…We want such type good sample from you.
K.V. Ramana Rao
Spin | 08-Aug-06 at 9:05 am | Permalink
Excellent work! Seldom found such easy understandable information.
Thank you.
Ahsan Shaikh | 28-Sep-06 at 2:04 pm | Permalink
David,
Its an excellent peice of work and must be recommended to spring newbies.
Hemanth | 05-Oct-06 at 9:07 am | Permalink
A rocking start for Spring Newbies . Thanks again
Regards,
Hemanth
Andy | 11-Dec-06 at 4:34 am | Permalink
Thanks David,
Indeed following your samples is the best way to start with Spring!
Bob | 25-Dec-06 at 1:48 am | Permalink
A very good start for Spring Newbies . Thanks again
Regards,
Bob
Krishna Kishore | 28-Dec-06 at 5:27 pm | Permalink
Thanks for the excellent work. I did spend lot of time to know how to start learning concepts, your examples gave me a good start.
Thanks a lot !!!
Ashok kumar | 01-May-07 at 10:24 am | Permalink
Excellent effort.
Pravu | 09-Apr-08 at 6:45 pm | Permalink
Excellent description of spring concept in java language.
Cheers,
Pravu Mishra.