spring编程---第一部分,spring简单介绍

Spring是一个综合的框架,包含了对DAO,Transaction、MVC、Remote,Security等相关技术的集成和支持

第一部分:对Spring进行概况的介绍:What is Spring?Features of Spring?  why use Spring? What Spring can do?

What is Spring?
   Spring is an open source framework,created by RodJohnson and described in his book Exper One-on-one:J2EE Design and Development;

Spring is a lightweight dependency injection and aspect-oriented container and framework.

Spring能够减少J2EE开发的复杂性,它提供了基于JavaBean的声明式编程,而之前,我们只能对Servlet、jsp、和EJB等进行声明式应用。
   所谓的声明式编程,指的是通过配置XML或者使用annotation从而完成某些工作,例如Hibernate、Servlet等。


The Features of Spring
1.Lightweight:Spring is lightweight in terms of both size and overhead
2.Dependency Injection:Spring promotes loose couping through a technique known ad DI,and this also called IOC.
3.Aspect-oriented:separate application bussiness logic from system services
4.Container:Spring manages the lifecycle and configuration of application objects
5.framework

Spring对大量的企业级服务做了再一次的封装,简化了API,不用考虑细节问题。

Why use Spring?
1.Wiring of components (Dependency Injection)
Promotes/simplifies decoupling,design to interfaces ,TDD.
2.Declarative programming without J2EE
Easily configured aspects,esp,transaction support
3.Simplify use of popular technologies
Abstractions insulate application from specifics,eliminate redunadant code,and handle common error conditions.
Underlying technology specifics still accessible(closures)


Spring 除了提供上述的IOC和AOP之外,同时能够简化常用技术的使用,例如提供了对ORM和JDBC等数据访问方案的支持,提供了对MVC的集成,提供了远程访问解决方案的集成等



  Spring包含了众多的模块,除了最基本的Spring core,Spring context和Spring AOP之外,其他模块的功能可以选择使用,也就是说,虽然Spring是一个一站式的解决方案,但是用户可以选择使用Spring中的某些功能,例如不使用Spring MVC ,而选择Struts MVC。

Spring's modules
根据上面的图形,我们很容易的看出spring的模块是由哪些组成的。现在,我们来详细的看看spring的各个模块
1.The core container
    Spring's core container contains the BeanFactory,which is the fundamental Spring container and the basis on whick Spring's DI is bassed.
2.Application context module
    This module extends the concept of BeanFactory.
3.AOP module
    Spring provides rich support for aspect-oriented programming in its AOP module
4.DAO module
    This module abstracts away the boilerplate code so that you can keep your database code clean and simple.
5.ORM integration module
    Spring's ORM support builds on the DAO support,providing a convenient way to build DAOS for several ORM solutions.
6.Spring MVC framework
7.Remoting
     Spring's remoting support enables you to expose the functionally of your Java objects as remote objects.
     Serveral remoting options are available ,including RMI,Hessian,Burlap,JAX-RPC and Spring's own HTTP invoker

Spring 除了能够集成RMI、Hessian等远程解决方案,并提供了对JAX-RPC以及JAX-WS的支持

spring可以与很多已有技术集成使用,例如:Struts+spring+hibernate

猜你喜欢

转载自lpf.iteye.com/blog/1487380