SyntaxHighlighter

Sunday, September 8, 2013

Spring Framework - Helping Points

Spring is a long existing framework. However, I came across using it very recently. So thought of putting a few key points of where Spring makes a developer's life easier.

Point 1: Dependency Injection
Perhaps, the most important aspect of Spring framework. After using it, the very simple and basic definition of this feature I can put as :
You have classes and then you have more classes. Each of these classes need certain information or input to work as you expect it to. Spring allows you to define these dependencies.
Or in other words you make sure your class/object gets what it needs to perform before it starts performing.

Point 2: Dependency Checking
I found this really useful. You can make use of simple xml configuration or better still and annotation(@Required) to make sure you provide values for all the properties of a class that is absolutely necessary for your functionality. And Spring helps you to validate whether required values are being set or not before actually your app starts working.

Point 3: AOP
Aspect Oriented Programming enables you to think of underlying aspects/services and design them in simple POJOs (Plain Old Java Objects). Prior to Spring, one would more concentrate on the actors of a particular problem rather than concentrating more on the problem.

The code is self explanatory. You are a person and it just says Hello to you.
The HelloYou class pulls a Person, whose name is your name (set in the Xml config file) and it displays "Hello <Your name>!". That's it!

No comments:

Post a Comment