SPRING FRAMEWORK
Spring framework is an open source Java platform that provides comprehensive infrastructure support for developing robust Java applications very easily and very rapidly. The core features of the Spring Framework can be used by any Java application.
Spring Frame Work Architecture
Spring framework is an open source Java platform that provides comprehensive infrastructure support for developing robust Java applications very easily and very rapidly. The core features of the Spring Framework can be used by any Java application.
Spring Frame Work Architecture
Core Container:
It consists of the Core, Beans, Context, and Expression Language modules. Ø The Core module provides the fundamental parts of the framework, including the IoC and Dependency Injection features.
Ø The Bean module provides BeanFactory which is a sophisticated implementation of the factory pattern.
Ø The Context module builds on the solid base provided by the Core and Beans modules and it is a medium to access any objects defined and configured. The ApplicationContext interface is the focal point of the Context module.
Ø The Expression Language module provides a powerful expression language for querying and manipulating an object graph at runtime.
Data Access/Integration:
The Data Access/Integration layer consists of the JDBC, ORM, OXM, JMS and Transaction modules whose detail is as follows:
Ø The JDBC module provides a JDBC-abstraction layer that removes the need to do tedious JDBC related coding.
Ø The ORM module provides integration layers for popular object-relational mapping APIs, including JPA, JDO, Hibernate, and iBatis.
Ø The OXM module provides an abstraction layer that supports Object/XML mapping implementations for JAXB, Castor, XMLBeans, JiBX and XStream.
Ø The Java Messaging Service JMS module contains features for producing and consuming messages.
Ø The Transaction module supports programmatic and declarative transaction management for classes that implement special interfaces and for all your POJOs.
Web:
The Web layer consists of the Web, Web-Servlet, Web-Struts, and Web-Portlet modules whose detail is as follows:
Ø The Web module provides basic web-oriented integration features such as multipart file-upload functionality and the initialization of IoC container using servlet listeners and a web-oriented application context.
Ø The Web-Servlet module contains Spring's model-view-controller (MVC) implementation for web applications.
Ø The Web-Struts module contains the support classes for integrating a classic Struts web tier within a Spring application.
Ø The Web-Portlet module provides the MVC implementation to be used in a portlet environment and mirrors the functionality of Web-Servlet module.
Event Handling in Spring
Spring provides the following standard events:
Ø ContextRefreshedEvent :
This event is published when the ApplicationContext is either initialized or refreshed. This can also be raised using the refresh() method on the ConfigurableApplicationContext interface.
Ø ContextStartedEvent :
This event is published when the ApplicationContext is started using the start() method on the ConfigurableApplicationContext interface. You can poll your database or you can re/start any stopped application after receiving this event.
Ø ContextStoppedEvent :
This event is published when the ApplicationContext is stopped using the stop() method theConfigurableApplicationContext
interface. You can do required housekeep work after receiving this event.
Ø ContextClosedEvent :
This event is published when the ApplicationContext is closed using the close() method on the ConfigurableApplicationContext
interface. A closed context reaches its end of life; it cannot be refreshed or restarted.
Ø RequestHandledEvent :
This is a web-specific event telling all beans that an HTTP request has been serviced.
MODULES
Data access framework
Spring provides these features
Ø Resource management - automatically acquiring and releasing database resources
Ø Exception handling - translating data access related exception to a Spring data access hierarchy
Ø Transaction participation - transparent participation in ongoing transactions
Ø Resource unwrapping - retrieving database objects from connection pool wrappers
Ø Abstraction for BLOB and CLOB handling.
Model-view-controller framework
Spring MVC is a request-based framework. The framework defines strategy interfaces for all of the responsibilities which must be handled by a modern request-based framework.The goal of each interface is to be simple and clear so that it's easy for Spring MVC users to write their own implementations if they so choose.
Responsibilities of Spring MVC
Ø HandlerMapping : selecting objects that handle incoming requests (handlers) based on any attribute or condition internal or external to those requests
Ø HandlerAdapter: execution of objects that handle incoming requests
Ø Controller: comes between Model and View to manage incoming requests and redirect to proper response. It acts as a gate that directs the incoming information. It switches between going into model or view.
Ø View: responsible for returning a response to the client. Some requests may go straight to view without going to the model part; others may go through all three.
Ø ViewResolver: selecting a View based on a logical name for the view .
Ø HandlerInterceptor: interception of incoming requests comparable but not equal to Servlet filters .
Ø LocaleResolver: resolving and optionally saving of the locale of an individual user
Ø MultipartResolver: facilitate working with file uploads by wrapping incoming requests
Remote access framework
This ia an abstraction for working with various RPC-based technologies available on the Java platform both for client connectivity and marshalling objects on servers.
Spring provides support for these protocols:
Ø HTTP-based protocols
o Hessian: binary serialization protocol, open-sourced and maintained by CORBA-based protocols
o RMI(1): method invocations using RMI infrastructure yet specific to Spring
o RMI (2): method invocations using RMI interfaces complying with regular RMI usage
o RMI-IIOP (CORBA): method invocations using RMI-IIOP/CORBA
Ø Enterprise JavaBean client integration
o Local EJB stateless session bean connectivity: connecting to local stateless session beans
o Remote EJB stateless session bean connectivity: connecting to remote stateless session beans
Ø SOAP
o Integration with the Apache Axis web services framework
Integration framework
Spring Integration is a framework for Enterprise application integration that provides reusable functions that are essential in messaging, or event-driven architectures.
Batch is a framework for batch processing that provides reusable functions that are essential in processing large volumes of records, including:
Ø logging/tracing
Ø transaction management
Ø job processing statistics
Ø job restart
Ø skip
Ø resource management
It also provides more advanced technical services and features that will enable extremely high-volume and high performance batch jobs through optimizations and partitioning techniques.
It consists of the Core, Beans, Context, and Expression Language modules. Ø The Core module provides the fundamental parts of the framework, including the IoC and Dependency Injection features.
Ø The Bean module provides BeanFactory which is a sophisticated implementation of the factory pattern.
Ø The Context module builds on the solid base provided by the Core and Beans modules and it is a medium to access any objects defined and configured. The ApplicationContext interface is the focal point of the Context module.
Ø The Expression Language module provides a powerful expression language for querying and manipulating an object graph at runtime.
Data Access/Integration:
The Data Access/Integration layer consists of the JDBC, ORM, OXM, JMS and Transaction modules whose detail is as follows:
Ø The JDBC module provides a JDBC-abstraction layer that removes the need to do tedious JDBC related coding.
Ø The ORM module provides integration layers for popular object-relational mapping APIs, including JPA, JDO, Hibernate, and iBatis.
Ø The OXM module provides an abstraction layer that supports Object/XML mapping implementations for JAXB, Castor, XMLBeans, JiBX and XStream.
Ø The Java Messaging Service JMS module contains features for producing and consuming messages.
Ø The Transaction module supports programmatic and declarative transaction management for classes that implement special interfaces and for all your POJOs.
Web:
The Web layer consists of the Web, Web-Servlet, Web-Struts, and Web-Portlet modules whose detail is as follows:
Ø The Web module provides basic web-oriented integration features such as multipart file-upload functionality and the initialization of IoC container using servlet listeners and a web-oriented application context.
Ø The Web-Servlet module contains Spring's model-view-controller (MVC) implementation for web applications.
Ø The Web-Struts module contains the support classes for integrating a classic Struts web tier within a Spring application.
Ø The Web-Portlet module provides the MVC implementation to be used in a portlet environment and mirrors the functionality of Web-Servlet module.
Event Handling in Spring
Spring provides the following standard events:
Ø ContextRefreshedEvent :
This event is published when the ApplicationContext is either initialized or refreshed. This can also be raised using the refresh() method on the ConfigurableApplicationContext interface.
Ø ContextStartedEvent :
This event is published when the ApplicationContext is started using the start() method on the ConfigurableApplicationContext interface. You can poll your database or you can re/start any stopped application after receiving this event.
Ø ContextStoppedEvent :
This event is published when the ApplicationContext is stopped using the stop() method theConfigurableApplicationContext
interface. You can do required housekeep work after receiving this event.
Ø ContextClosedEvent :
This event is published when the ApplicationContext is closed using the close() method on the ConfigurableApplicationContext
interface. A closed context reaches its end of life; it cannot be refreshed or restarted.
Ø RequestHandledEvent :
This is a web-specific event telling all beans that an HTTP request has been serviced.
MODULES
Data access framework
Spring provides these features
Ø Resource management - automatically acquiring and releasing database resources
Ø Exception handling - translating data access related exception to a Spring data access hierarchy
Ø Transaction participation - transparent participation in ongoing transactions
Ø Resource unwrapping - retrieving database objects from connection pool wrappers
Ø Abstraction for BLOB and CLOB handling.
Model-view-controller framework
Spring MVC is a request-based framework. The framework defines strategy interfaces for all of the responsibilities which must be handled by a modern request-based framework.The goal of each interface is to be simple and clear so that it's easy for Spring MVC users to write their own implementations if they so choose.
Responsibilities of Spring MVC
Ø HandlerMapping : selecting objects that handle incoming requests (handlers) based on any attribute or condition internal or external to those requests
Ø HandlerAdapter: execution of objects that handle incoming requests
Ø Controller: comes between Model and View to manage incoming requests and redirect to proper response. It acts as a gate that directs the incoming information. It switches between going into model or view.
Ø View: responsible for returning a response to the client. Some requests may go straight to view without going to the model part; others may go through all three.
Ø ViewResolver: selecting a View based on a logical name for the view .
Ø HandlerInterceptor: interception of incoming requests comparable but not equal to Servlet filters .
Ø LocaleResolver: resolving and optionally saving of the locale of an individual user
Ø MultipartResolver: facilitate working with file uploads by wrapping incoming requests
Remote access framework
This ia an abstraction for working with various RPC-based technologies available on the Java platform both for client connectivity and marshalling objects on servers.
Spring provides support for these protocols:
Ø HTTP-based protocols
o Hessian: binary serialization protocol, open-sourced and maintained by CORBA-based protocols
o RMI(1): method invocations using RMI infrastructure yet specific to Spring
o RMI (2): method invocations using RMI interfaces complying with regular RMI usage
o RMI-IIOP (CORBA): method invocations using RMI-IIOP/CORBA
Ø Enterprise JavaBean client integration
o Local EJB stateless session bean connectivity: connecting to local stateless session beans
o Remote EJB stateless session bean connectivity: connecting to remote stateless session beans
Ø SOAP
o Integration with the Apache Axis web services framework
Integration framework
Spring Integration is a framework for Enterprise application integration that provides reusable functions that are essential in messaging, or event-driven architectures.
- routers
- transformers
- adapters to integrate with other technologies and systems (HTTP, AMQP, JMS, XMPP, SMTP, IMAP, FTP(as well as FTPS/SFTP), file systems, etc.)
- filters
- service activators
- management and auditing
Batch is a framework for batch processing that provides reusable functions that are essential in processing large volumes of records, including:
Ø logging/tracing
Ø transaction management
Ø job processing statistics
Ø job restart
Ø skip
Ø resource management
It also provides more advanced technical services and features that will enable extremely high-volume and high performance batch jobs through optimizations and partitioning techniques.