Are you wondering why you are forced to read so many books? Just remember one sentence: Read a lot and make trip further. you can benefit a lot from books.
想知道为什么要读那么多书吗?请记住一句话:读万卷书,行万里路。你会从书中获益良多。
Spring started as a lightweight alternative to Java Enterprise Edition (JEE, or J2EE as it was known at the time).
Spring诞生时是Java企业版(Java Enterprise Edition,JEE,也称J2EE)的轻量级代替品。
Rather than develop components as heavyweight Enterprise JavaBeans (EJBs), Spring offered a simpler approach to enterprise Java development, utilizing dependency injection and aspect-oriented programming to achieve the capa- bilities of EJB with plain old Java objects (POJOs).
无需 开发重量级的Enterprise JavaBean(EJB),Spring提供了更简单的企业级开发,利用依赖注入和切面编程,用简单的Java对象POJO实现EJB的功能
But while Spring was lightweight in terms of component code, it was heavyweight in terms of configuration.
但Spring在开发组件的时候很轻量级,但在配置方面很重
Initially, Spring was configured with XML (and lots of it).
一开始的时候,Spring是使用XML进行配置的,而且很多XML配置
Spring 2.5 introduced annotation-based component-scanning, which eliminated a great deal of explicit XML configuration for an application’s own components.
Spring 2.5引入了基于注解的组件扫描,这消除了大量针对应用程序自身组件的显式XML配置。
And Spring 3.0 introduced a Java-based configuration as a type-safe and refactorable option to XML.
Spring 3.0引入了基于Java的配置,这是一种类型安全的可重构配置方式, 可以代替XML。
Even so, there was no escape from configuration.
尽管如此,我们依旧没能逃脱配置的魔爪。
Enabling certain Spring features such as transaction management and Spring MVC required explicit configuration, either in XML or Java.
开启某些Spring特性时,比如事务管理和Spring MVC,还是需要用XML或Java进行显式配置。
Enabling third-party library features such as Thymeleaf-based web views required explicit configuration.
启用第三方库时也需要显式配置,比如基于 Thymeleaf的Web视图。
Configuring servlets and filters (such as Spring’s DispatcherServlet) required explicit configuration in web.xml or in a servlet initializer.
配置Servlet 和 过滤器(比如Spring的DispatcherServlet)同样需要在 web.xml或Servlet初始化代码里进行显式配置。
Component-scanning reduced configuration and Java configuration made it less awkward, but Spring still required a lot of configuration.
配置扫描减少配置量, Java配置让它看上去简洁 不少,但Spring还是需要不少配置。
All of that configuration represents development friction.
这些配置都代表了开发时的损耗。
Any time spent writing configuration is time spent not writing application logic. The mental shift required to think about configuring a Spring feature distracts from solving the business problem.
因为在思考Spring特性配置和解决业务问题之间需要 进行思维切换,所以写配置挤占了写应用程序逻辑的时间。
Like any framework, Spring does a lot for you, but it demands that you do a lot for it in return.
和所有框架一样,Spring实用,但与 此同时它要求的回报也不少。
Moreover, project dependency management is a thankless task.
除此之外,项目的依赖管理也是件吃力不讨好的事情。
Deciding what libraries need to be part of the project build is tricky enough. But it’s even more challenging to know which versions of those libraries will play well with others
决定项目里要用哪些库就已经够让人 头痛的了,你还要知道这些库的哪个版本和其他库不会有冲突,这难题实在太棘手。
As important as it is, dependency management is another form of friction.
并且,依赖管理也是一种损耗,添加依赖不是写应用程序代码。
When you’re adding dependencies to your build, you’re not writing application code. Any incompatibilities that come from selecting the wrong versions of those dependencies can be a real productivity killer.
一旦选错了依赖的版本,随 之而来的不兼容问题毫无疑问会是生产力杀手。
Spring Boot has changed all of that.
Spring Boot 将改变这一切