Spring Technology Insider Note 1

Source: Internet
Author: User

Spring's design goals (why use spring)
如果我们要简要地描述Spring的设计目标,可以这么说,Spring为开发者提供的是一个一站式的轻量级应用开发框架(平台)。作为平台,Spring抽象了我们在许多应用开发中遇到的共性问题;同时,作为一个轻量级的应用开发框架,Spring和传统的J2EE开发相比,有其自身的特点。通过这些自身的特点, Spring充分体现了它的设计理念:在Java EE的应用开发中,支持POJO和使用JavaBean的开发方式,使应用面向接口开发,充分支持OO(面向对象)的设计方法。比如,在Java EE应用开发中,传统的EJB开发需要依赖按照J2EE规范实现的J2EE应用服务器。我们的应用在设计,特别是实现时,往往需要遵循一系列的接口标准,才能够在应用服务器的环境中得到测试和部署。这种开发方式,使应用在可测试性和部署上都会受到一些影响。Spring的设计理念采用了相对EJB而言的轻量级开发思想,即使用POJO的开发方式,只需要使用简单的Java对象或者JavaBean就能进行Java EE开发,这样开发的入门、测试、应用部署都得到了简化。另一方面,在我们的应用开发中,往往会涉及复杂的对象耦合关系,如果在Java代码中处理这些耦合关系,对代码的维护性和应用扩展性会带来许多不便。而如果使用Spring作为应用开发平台,通过使用Spring的IoC容器,可以对这些耦合关系(对Java代码而言)实现一个文本化、外部化的工作,也就是说,通过一个或几个XML文件,我们就可以方便地对应用对象的耦合关系进行浏览、修改和维护,这样,可以在很大程度上简化应用开发。同时,通过IoC容器实现的依赖反转,把依赖关系的管理从Java对象中解放出来,交给了IoC容器(或者说是Spring框架)来完成,从而完成了对象之间的关系解耦: 原来的对象-对象的关系,转化为对象-IoC容器-对象的关系,通过这种对象-IoC容器-对象的关系,更体现出IoC容器对应用的平台作用。

From the original, refine 3 points:
1. One-Stop lightweight application development box
2, as a platform, abstract the application development of common problems
3, support Pojo and use JavaBean development way, make the application oriented interface development, fully support OO (object oriented) design method

Personal understanding
One-stop: an ecosystem around the spring core, such as SPRINGMVC, cloud, data, and more
Lightweight: Spring is lightweight both in terms of size and overhead. The full spring framework can be published in a jar file with a size of more than 1MB. and the processing overhead required by spring is negligible. In addition, spring is non-intrusive: Typically, objects in spring applications do not depend on a particular class of spring
Common problems: The dependency relationship between completely decoupled classes
Interface oriented: XML fragment below
<beans default-autowire= "ByName" >
<bean id= "Test" class= "Demospring.test" >
<property name= "Person" ref= "Pdao"/>
</bean>
<bean id= "Pdao" class= "Demospring.girl" ></bean>
</beans>
Demospring relies on the person interface, ref points to the specific implementation class Demospring.girl, and the duly interface-oriented

These are the spring's design goals, and why use spring rather than other IOC containers to compare the Guice developed by Google Daniel.

Guice its Advantage is: br/>1, fast, claiming to be 100 times times faster than spring.
2, no external configuration (if you need to use external can choose Guice Extension package), based on the annotation characteristics, support refactoring, code static check.
3, simple, fast, basic no learning costs.
and spring differences, see https://www.cnblogs.com/huapox/p/3516382.html
The Guice advantage is the high efficiency, the disadvantage is the code intrusive (@inject directly into the code, coupled to the class level), with other frameworks integrated without spring good.

Now is the enterprise level project, which is the simple project?

Spring Technology Insider Note 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.