Spring Framework

Introduction
- Rod Johnson started SpringSource company and developed Spring framework for Apache 2.0 in June 2003.
- The Spring Framework is an open source application framework and inversion of control container for the Java platform.
- It provides comprehensive infrastructure support or developing Java applications.
- Spring handles the infrastructure so you can focus on your application.
Why Spring?
- Spring is a framework like Struts and Hibernate.
- Spring is famous in the industry.
- Spring and Hibernate are extremely popular and widely used in the industry.
- Spring framework is lightweight as it does not involve installation, start and stop activities associated with a container.
Java Frameworks
In Java technology there are so many
frameworks that helps the programmers to build complex applications easily.
You can choose these frameworks for
building your applications.
- Hibernate: Database access mechanism
- Struts: Web layer
- EJBs: Services like transactions, security, and messaging
- Log4J: Logging
- More...
-Java Frameworks problem:
- Applications that use these varied frameworks and services become difficult to maintain as it grows including testing.
-Applications need:
- Applications that use a number of frameworks and the services have to remain maintainable.
- Codes should be loosely coupled with the frameworks so that testing and reusability become easy.
-Spring Framework advantages:
- Spring Framework provides a light-weight solution to develop maintainable and reusable enterprise applications.
- It provides very simple and rich facilities to integrate various frameworks, technologies, and services in the application.
-To back up its attack on Java
complexity, Spring employs four key strategies:
- Lightweight and minimally invasive development with Plain Old Java Objects(POJOs).
- Loose coupling through dependency injection and interface orientation.
- Declarative programming through aspects and common conventions.
- Boilerplate reduction through aspects and templates.
Spring Featured/Modules
- Inversion of Control: Done through Dependency Injection.
- Aspect Oriented Programming: Enabling implementing cross-cutting concerns.
- Data Access: Works with JDBC and Hibernate.
- Model View Controller: Provide MVC Support through servlets and struts. This is web framework.
- Remote Access Framework: Supports remote access through RMI, web service through SOAP and REST.
- Remote Management: JMX is the technology that is used to manage the system objects and devices like printers.
- Messaging: Uses JMS to communicate through Message Queues.
- Testing: Supports classes for writing unit test cases and integration test cases.
- Convention over Configuration: Spring Roo is another framework which eases the development. This is Rapid Application Development tool.
- Authentication and Authorization: This is provided by Spring Security module.
Spring Architecture
Architecture has 5 layers:
- Data Access/Integration
- Web
- Aspect
- Core
- Test
Data Access/Integration has JDBC,
ORM, OXM, JMS and Transaction modules.
- JDBC: JDBC code can be done using JDBC Template.
- ORM: Can develop code using ORM tools like Hibernate, iBatis etc.
- OXM: OXM stands for Object to XML Mapping. It supports technologies like JAB.
- JMS: Can send JMS operations in this module.
- Transaction: Supports both Programmatic and Declarative Transaction Management. Programmatic is handling in the program and declarative is handling either as part of Annotation or using XML.
Web layer has WebSocket, Servlet,
Web, Portlet modules.
- WebSocket: This module provides support for WebSocket-based, two-way communication between the client and the server in web applications.
- Servlet: Used for servlets.
- Web: This module will initialize the IOC Container using servlet listener.
- Portlet: This module provides the MVC implementation to be used in a portlet environment and mirrors the functionality of Web-Servlet module.
Aspect and Test layer
- AOP: Used for Aspect Oriented Programming. This will allow to define interceptors and point-cuts to separate them as required.
- Aspects: This module helps to integrate with AspectJ. AspectJ is another AOP framework.
- Instrumentation: Instrumentation is the ability to monitor the level of products performance, to diagnose the errors and write the trace information.
- Messaging: The Messaging module provides support for STOMP as the WebSocket sub-protocol to use in applications. It also supports an annotation programming model for routing and processing STOMP messages from WebSocket clients.
- Test: Supports to test the spring modules using Junit framework.
Core layer has Beans, Core, Context,
SpEL modules.
- Beans: It implements beanfactory through factory pattern.
- Core: It has DI and IOC features.
- Context: Used for ApplicationContext. It uses Core and Beans module.
- SpEL: This module provides a powerful expression language for querying and manipulating an object graph at runtime.
No comments:
Post a Comment