Spring Primer

Spring is Framework for enabling the use of Inversion of Control (IOC) or dependency injection.

Dependency Lookup -Application logic is in control of exactly what resource is acquired and create a hard dependency on some other class in the process. Check the below snippets of code on dependency lookup.

Auth auth = AuthFactory.getInstance(); or  Auth auth = new AuthImpl(); or Context based lookup.

Dependency Injection – solves the problem by removing the hard relationship with the classes. It helps unit testing the complex application and move application logic from one environment to another. Spring use the Don’t Repeat Yourself (DRY) Principle. This encourages developers to create logic once and only once. Use POJO – standard helper and library classes.

Aspect-Oriented Programming (AOP) – an approach to a set of problems that do not fit into Object Oriented Programing (OOP) to problem solving. The use of an AOP framework allows a solution to a problem to be applied before and after the invocation of various externally identified method calls. Example of Spring AOP is the declarative transaction management library.

With use of declarative transaction management,

public class AuthServiceImp extends ServiceImpl implements AuthService {
 public User createUser(){
           return dao.save(new Use());

Examples of AOP – managing transactions, security and providing auditing and logging info.

Spring libraries supports all of the Java EE – manage JTA transactions, connect to db, enforce security, send email, schedule operations, manage JMX, generated reports …list goes on.

Spring MVC – divided between views, controller classes and the model.

Views are JSPs, controller classes are provided that supports basic forms to any type complex form. you can chose the impl for the model.

Transfer classes (form beans) are conventional POJOs and validation framework is both POJO and simple to configure.

Spring Web Flow – model your application behavior as a state machine. Application resides in various states and events are raised to move application between these states. This is suited to more dynamic problems. ease of design – State machines are easy to model as diagrams.

Spring Portlet MVC – supports JSR 168 development


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s