<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    狂人思維·成都
    Google
    軟件架構,開則持續,合則穩健;亦開亦合,剛柔并濟;講究平衡如同生活之中庸和諧.
    E-MAIL:guojian。zhang@gmail。com
    posts - 19,  comments - 62,  trackbacks - 0

    Spring's Values

    To make the most effective use of Spring, it's important to understand the motivation behind it. Spring partly owes its success to its being based on a clear vision, and remaining true to that vision as its scope has expanded.

    The key Spring values can be summarized as follows:

    • Spring is a non-invasive framework. This is the key departure from most previous frameworks. Whereas traditional frameworks such as EJB or Apache Avalon force application code to be aware of the framework, implementing framework-specific interfaces or extending framework- specific classes, Spring aims to minimize the dependence of application code on the framework. Thus Spring can configure application objects that don't import Spring APIs; it can even be used to configure many legacy classes that were written without any knowledge of Spring. This has many benefits. For example:

      • Application code written as part of a Spring application can be run without Spring or any other container.

      • Lock-in to Spring is minimized. For example, you could migrate to another lightweight container, or possibly even reuse application objects in an EJB 3.0 EJB container, which supports a subset of Spring's Dependency Injection capability.

      • Migration to future versions of Spring is easier. The less your code depends on the framework, the greater the decoupling between the implementation of your application and that of the framework. Thus the implementation of Spring can change significantly without breaking your code, allowing the framework to be improved while preserving backward compatibility.

        Of course in some areas, such as the web framework, it's impossible to avoid application code depending on the framework. But Spring consistently attempts to reach the non-invasive ideal where configuration management is concerned.

    • Spring provides a consistent programming model, usable in any environment. Many web applications simply don't need to run on expensive, high-end, application servers, but are better off running on a web container such as Tomcat or Jetty. It's also important to remember that not all applications are server-side applications. Spring provides a programming model that insulates application code from environment details such as JNDI, making code less dependent on its runtime context.

    • Spring aims to promote code reuse. Spring helps to avoid the need to make some important hard decisions up front, like whether your application will ever use JTA or JNDI; Spring abstractions will allow you to deploy your code in a different environment if you ever need to. Thus Spring enables you to defer architectural choices, potentially delivering benefits such as the need to purchase an application server license only when you know exactly what your platform requirements are, following tests of throughput and scalability.

    • Spring aims to facilitate Object Oriented design in J2EE applications. You might be asking "How can a J2EE application, written in Java — an OO language — not be OO?" In reality, many J2EE applications do not deserve the name of OO applications. Spring aims to remove some of the impediments in place of OO in traditional designs. As one of the reviewers on this book commented, "The code I've seen from my team in the year since we adopted Spring has consistently been better factored, more coherent, loosely coupled and reusable."

    • Spring aims to facilitate good programming practice, such as programming to interfaces, rather than classes. Use of an IoC container such as Spring greatly reduces the complexity of coding to interfaces, rather than classes, by elegantly concealing the specification of the desired implementation class and satisfying its configuration requirements. Callers using the object through its interface are shielded from this detail, which may change as the application evolves.

    • Spring promotes pluggability. Spring encourages you to think of application objects as named services. Ideally, the dependencies between such services are expressed in terms of interfaces. Thus you can swap one service for another without impacting the rest of your application. The way in which each service is configured is concealed from the client view of that service.

    • Spring facilitates the extraction of configuration values from Java code into XML or properties files. While some configuration values may be validly coded in Java, all nontrivial applications need some configuration externalized from Java source code, to allow its management without recompilation or Java coding skills. (For example, if there is a timeout property on a particular object, it should be possible to alter its value without being a Java programmer.) Spring encourages developers to externalize configuration that might otherwise have been inappropriately hard-coded in Java source code. More configurable code is typically more maintainable and reusable.

    • Spring is designed so that applications using it are as easy as possible to test. As far as possible, application objects will be POJOs, and POJOs are easy to test; dependence on Spring APIs will normally be in the form of interfaces that are easy to stub or mock. Unlike the case of JNDI, for example, stubbing or mocking is easy; unlike the case of Struts, for example, application classes are seldom forced to extend framework classes that themselves have complex dependencies.

    • Spring is consistent. Both in different runtime environments and different parts of the framework, Spring uses a consistent approach. Once you learn one part of the framework, you'll find that that knowledge can be leveraged in many others.

    • Spring promotes architectural choice. While Spring provides an architectural backbone, Spring aims to facilitate replaceability of each layer. For example, with a Spring middle tier, you should be able to switch from one O/R mapping framework to another with minimal impact on business logic code, or switch from, say, Struts to Spring MVC or WebWork with no impact on the middle tier.

    • Spring does not reinvent the wheel. Despite its broad scope, Spring does not introduce its own solution in areas such as O/R mapping where there are already good solutions. Similarly, it does not implement its own logging abstraction, connection pool, distributed transaction coordinator, remoting protocols, or other system services that are already well-served in other products or application servers. However, Spring does make these existing solutions significantly easier to use, and places them in a consistent architectural approach.

    We'll examine these values later in this chapter and throughout this book. Many of these values are also followed by other lightweight frameworks. What makes Spring unique is that it provides such a consistent approach to delivering on them, and provides a wide enough range of services to be helpful throughout typical applications.


    posted on 2007-04-15 13:49 狂人思維·成都 閱讀(243) 評論(0)  編輯  收藏 所屬分類: J2EE應用

    只有注冊用戶登錄后才能發表評論。


    網站導航:
    相關文章:
     

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿

    隨筆分類(31)

    隨筆檔案(19)

    文章分類(3)

    文章檔案(3)

    我關注的Blogs

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 九九免费久久这里有精品23| 伊人久久大香线蕉免费视频| 婷婷综合缴情亚洲狠狠尤物| 中文字幕在线免费观看视频| www.亚洲日本| 亚洲精品人成无码中文毛片| 91久久青青草原线免费| 亚洲av无码专区国产不乱码 | 免费黄网站在线看| 91亚洲性爱在线视频| 亚洲国产黄在线观看| 免费A级毛片无码专区| 蜜臀亚洲AV无码精品国产午夜.| 国产精品亚洲аv无码播放| 国产精品久久久久免费a∨| 三级黄色在线免费观看| 中文文字幕文字幕亚洲色| 亚洲综合在线另类色区奇米| 成人在线免费观看| 在线人成免费视频69国产| 性色av极品无码专区亚洲| 亚洲美女中文字幕| 自拍偷自拍亚洲精品第1页| 午夜两性色视频免费网站| 久久99热精品免费观看牛牛| 美女黄网站人色视频免费| 亚洲电影在线播放| 国产成人精品日本亚洲| 四虎影视在线永久免费观看| 亚洲一级免费毛片| 国产在线精品免费aaa片| 精品特级一级毛片免费观看| 亚洲Av无码一区二区二三区| 久久亚洲高清观看| 亚洲AV无码一区二区三区国产| 好爽又高潮了毛片免费下载 | 岛国片在线免费观看| 最近免费mv在线电影| 国产在线观看免费av站| 三年片在线观看免费观看大全中国| 亚洲人成人网毛片在线播放|