Spring is a framework for building Java applications.We can use Spring to build any application in Java, for example, stand-alone, web, or Java Enterprise Edition (JEE) applications).
Spring's philosophy is minimal impact.
Spring is lightweight in the sense that we have to make few, if any, changes to your application code to gain the benefits of the Spring core.
The core of the Spring Frameworkis based onthe principle of Inversion of Control (IoC).
IoC is a techniquethatexternalizes the creation and management of component dependencies.
Spring's Injecting Dependencies implementationis based ontwo core Java concepts:
JavaBeans
interfaces
The benefits ofusing DIrather thana more traditional approach:
Reduce glue code
Simplified application configuration
Manage common dependenciesin a single repository
Improve testability
Promote good application design
控制反转或依赖注入
Spring框架的核心基于控制反转(IoC)原理。
IoC是一种将组件依赖关系的创建和管理外部化的技术。
Spring的Injecting Dependencies实现基于两个核心Java概念:
* JavaBeans
* 接口
使用DI比起更传统的方法的好处:
* 减少胶水代码
* 简化的应用程序配置
* 在单个存储库中管理常见依赖项
* 提高可测试性
* 促进良好的应用程序设计
Spring Features
Spring 特性
Spring offers many modules, features and functions.
Aspect-Oriented Programming with Spring. AOP provides the ability to implement crosscutting logic, which applies to many parts of your application, in a single place.
Spring Expression Language. Expression Language (EL) allows us to manipulate Java objects at runtime.
Validation in Spring. Springprovides a built-in validation API by way of the Validator interface.
Accessing Data in Spring. Spring provides integration with a choice selection of these data access tools. In addition, Spring makes plain vanilla JDBC a viable option for many projects, with its simplified wrapper APIs around the standard API. Spring's data access module provides out-of-the-box support for JDBC, Hibernate, JDO, and the JPA.
Object/XML Mapping in Spring. Spring supports many common Java-to-XML mapping frameworks and,as usual,eliminatesthe need for directlycouplingto any specific implementation.
Managing Transactions. Spring provides an abstraction layer for transaction management, allowing for programmatic and declarative transaction control.