Tuesday, November 26, 2013

Basic concepts of Spring

Basic concepts of Spring

The basic philosophy underlying spring framework is to avoid tight coupling between various modules. The advantage of using spring framework is that it lets the developer concentrate on developing the application while the underlying spring framework takes care of transaction APIs, remote APIs, JMX APIs, JMS APIs.

Benefits of using Spring Framework


  • Works on POJOs. Hence easier for dependency injection / injection of test data.
  • With the Dependency Injection(DI) approach, dependencies are explicit and evident in constructor or JavaBean properties
  • Enhances modularity. Provides more readable codes.
  • Provides loose coupling between different modules.
  • Effective in organizing the middle-tier applications.
  • Flexible use of Dependency injection. Can be configured by XML based schema or annotation-based style.
  • Supports declarative transaction, caching, validation and formatting.

Like its other counterparts, spring framework is essentially a skeleton which provides a solid ground work around which the application can be built. The existence of this skeleton structure guides and helps the developer throughout the application development process. Likewise, spring framework has frozen spots – those places which are rigid in order to maintain the blueprint as such , and hot spots which can be contributed by the developer. In our context, hot spots mostly refer to POJOs(Plain Old Java Object).
 

Inversion Of Control(IoC)


The concept of coding in abstraction effectively introduces much better coding standards. Usually while dealing with very large codes, the reason contributing to rigidity of the program is that, the higher modules always depend on the lower modules for their functioning and hence modification at one place reflects badly on other unexpected areas in the code. This problem is effectively solved in spring by leaving the work of dependency injection to the underlying framework.
 
DependencyInjectionImage

 

Aspect Oriented Programming


AOP in spring allows cross cutting of concerns. AOP is not dependent on Spring’s IOC container. The key unit of modularity in OOP(Object Oriented Programming) is the class, whereas in AOP the unit of modularity is the aspect. Spring AOP is implemented in pure java and hence does not require a separate compilation process.
AOP

No comments: