Spring
|
Important
|
Spring is an application framework. Unlike single-tier frameworks such as Struts or Hibernate, Spring aims to help structure whole applications in a consistent, productive manner, pulling together best-of-breed single-tier frameworks to create a coherent architecture.
|
Problems with the Traditional Approach to J2EE
传统J2EE方法存在的问题
- J2EE applications tend to contain excessive amounts of "plumbing" code.多
- Many J2EE applications use a distributed object model where this is inappropriate.杂
- The EJB component model is unduly complex.不当
- EJB is overused.过度使用
- Many "J2EE design patterns" are not, in fact, design patterns, but workarounds for technology limitations.技术跟不上
- J2EE applications are hard to unit test.测试难
- Certain J2EE technologies have simply failed.
Enter Spring
接触Spring
- Inversion of Control container:倒置控制
- Aspect-Oriented Programming (AOP) framework:
- Data access abstraction:
- JDBC simplification:
- Transaction management:
- MVC web framework:
- Simplification for working with JNDI, JTA, and other J2EE APIs:
- Lightweight remoting:
- JMS support:
- JMX support:
- Support for a comprehensive testing strategy for application developers:
The key Spring values can be summarized as follows:
· Spring is a non-invasive framework.非侵入
· Spring provides a consistent programming model, usable in any environment.
· Spring aims to promote code reuse.复用
· Spring aims to facilitate Object Oriented design in J2EE applications.
· Spring aims to facilitate good programming practice, such as programming to interfaces, rather than classes.面向接口
· Spring promotes pluggability.性能
· Spring facilitates the extraction of configuration values from Java code into XML or properties files.
· Spring is designed so that applications using it are as easy as possible to test.
· Spring is consistent.
· Spring promotes architectural choice.
· Spring does not reinvent the wheel.