Introduction to the Spring Framework
A. Introduce spring framework
Spring Framework or the Spring, is an open-source framework using Java programming language. It is seen as a best architectural solution of the current Java EE.
According to the design of the Spring Framework, which allows Java programmers have many more option.
At the same time provide a convenient solution, the fully documented, easy to use, consistent with common practice in software engineering.
B. The main module
Spring is the business layer
Spring is include 7 modules
- Core Container
- Core package is the most basic part of the framework, providing features IoC (Inversion of Control: Box containing controlled reverse) and Dependency Injection.
- BeanFactory – installation factory pattern allows you to merge the dependencies between objects in the configuration file.
- Spring Context/Application Context
- The top of the Core package is the Context package – provides access to the object.
- Context package features inherited from the beans package and adds multi-language functionality (I18N), communication events, resource-loading,…
- Spring AOP (Aspect Oriented Programming)
- Spring AOP module integrates object-oriented programming in Spring framework, through its configuration. Spring AOP module provides transaction management services for objects in any application using Spring. With Spring AOP you can incorporate declarative transaction management into applications without relying on EJB components.
- Spring AOP module also introduces metadata programming to Spring. We can add annotation to the source code to guide Spring and how to contact aspect.
- Spring DAO
- DAO package provides JDBC layer, eliminating tthe lengthy code of JDBC and change coding error is determined by the database vendor. JDBC provides programming package as declarative transaction management good.
- JDBC and DAO layer offer a meaningful exception hierarchy for managing connections to databases, exception handling and error messages thrown by database vendors. The exception hierarchy simplifies error handling and reduces the volume of code that we need to write as open and close the connection. This module also provides transaction management services for objects in Spring applications.
- Spring ORM
- ORM package provides integration with object-relational mapping APIs, including JDO, Hibernate, iBatis.
- Using the ORM package you can use all the objects-relational mapping which incorporates the latest features such as declarative transaction management Spring.
- Spring Web module
- Spring Web package provides features like web: file-upload functionality, the initialization IoC container using the listen-oriented web application serlvet and context.
- Application module provides context for the web application context. It also supports integration with Struts, JSF and Webwork. Web module also eases the task control multiple requests and binding request parameters to domain objects or entity.
- Spring MVC Framework
- Spring Framework is an open source application popular for Java EE development easier. It consists of a container, a framework for managing components, and a set of snap-in services for web user interfaces, transactions, …. Part of the Spring Framework is Spring Web MVC, MVC model extended to create web applications.
- MVC framework is a full-featured installation MVC to build Web applications. The MVC framework is configured via interfaces and accommodates numerous view technologies including JSP, Velocity, Tiles, and generation of PDF and Excel files. . Spring MVC framework provides a clear distinction between the domain model and web form.
C. Reasons for using
- Every framework has been integrated very well into Spring.
- Works very well when applied in MVC architecture.
- Using the plug-in mechanism
- Combines well with ORM (object-relational) frameworks such as Hibernate Mapping.
- Easy of Application Testing.
- Less complex than the other frameworks.
- Community users are many, many new books are published.