Friday, July 24, 2009

Spring - What is it?

Java was in the process of maturing during the year of 1996. Many rich and dynamic web applications were being developed. But, people started to realize the shortcomings of Java Applets. This paved the way for the invention of Java Beans - a software component model for Java. They were primarily used for building user interface widgets and seemed too simple to be able to do any "real" work. Later in the year if 1998, Enterprise Java Beans (EJB) extended the normal beans to the server side, even though losing its simplicity. Its complexity reduced its popularity and easiness. This is where Aspect Oriented Programming (AOP) and Dependency Injection (DI) found spot to flourish. These methodologies furnish the POJOs (Plain Old Java Object) with a mirror image of an EJB using a declarative programming model, but completly avoiding all the complexities. Better late than never !!!

Leading the development based on lightweight POJOs is the Spring Framework.

Spring is an open source framework, created by Rod Johnson benefitting from its features such as simplicity, testability and loose coupling. Basically, it is a lightweight dependency injection and aspect-oriented container and framework. Breaking it down into simpler terms:-

  • Lightweight -> in size (distributable JAR less than 2.5MB) and overhead of processing
  • Dependency Injection -> loose coupling by means of objects not creating or looking up for dependent objects on their own, instead giving their dependencies during instantiation without being asked by them
  • Aspect-oriented -> separating business logic from system services (logging, security, transaction management) where objects deal with only things they are supposed to do
  • Container -> contains and controls the lifecycle and configuration of application objects
  • Framework -> configures and composes complex applications from simpler components with the help from an XML configuration file
Let us have a peep into the Spring Modules:-
  • Core -> provides the fundamental functionality of Spring, onbased on the BeanFactory
  • ApplicationContext -> builds on top of core and makes Spring a framework, adding support for internationalization messages, application life-cycle events, email, JNDI access, remoting, scheduling, validation, etc.
  • AOP -> decoupling application-wide concerns from objects to which they are applied
  • JDBC abstraction (DAO) -> abstracts away the boilerplate code of JDBC keeping the database code clean and simple, also building meaningful exceptions over the normal SQL Exceptions
  • ORM -> supports various ORM frameworks like Hibernate, JPA, JDO, iBatis, etc in addition to JDBC
  • JMX -> helps expose application's beans as Java Management Extensions beans supporting monitoring and reconfiguring a running application
  • JCA (Java EE Connector API) -> integrates Java applications with various information systems like databases and mainframes, all scattered in disparate servers and platforms
  • MVC Framework -> separates user interface from application logic, also supporting existing MVCs in market like Struts, JSF, etc
  • Portlet MVC -> aggregating several bits of functionality on a single web page providing a view into several applications at once
  • Web -> support classes for MVC applications
  • Remoting -> access applications over the network, expose objects' functionality as remote objects, all considering the objects as simple POJOs
  • JMS -> guarantees message delivery throught JMS message queues and topics and helps create message-driven POJOs capable of consuming asynchronous messages

No comments:

Post a Comment