附录A 外文翻译—原文部分
毋庸置疑,Spring Boot在众多从事Java微服务开发的程序员体中是一个很特别的存在。说它特别是因为它确实简化了基于Spring技术栈的应用/微服务开发过程,使得我们能够很快速地就搭建起一个应用的脚手架并在其上进行项目的开发,再也不用像以前那样使用大量的XML或是注解了,应用在这样的约定优于配置的前提下可以以最快的速度创建出来。
Spring Boot从这一点来说极大解放了开发者,使得开发者从之前繁琐的配置中解脱出来,转而专注于应用的业务逻辑开发。这样,我们的系统的开发周期就会大大缩短,交付周期也越来越频繁了,这同样也是Spring Boot为我们广大开发者所带来的巨大好处。我们可以尽情享受这样一个优秀框架在方方面面所带来的功能,甚至很多功能都可以做到开箱即用,只需在POM或是adle中简单配置一下即可,相比于之前的Spring MVC等传统的Web开发模式来说简化了太多太多。
总的来说,Spring Boot在如下几个方面为我们带来了巨大的效能提升:
约定优于配置。按照Spring Boot的方式进行简单的配置后,功能就可以直接使用了。
1. 自动装配。Spring Boot在启动时会自动探测类路径下的各种类型,实现类型的自动装配,无需开发者再通过XML或是注解进行显式的类型装配了,这一点要拜@EnableAutoConfiguration注解或是更为全面的@SpringBootApplication 注解所赐。
内嵌各种Servlet容器。
2. Spring Boot内嵌了Tomcat、Jetty与Undertow等Servlet容器,使得我们可以像开发普通的Java应用那样直接通过main方法来启动容器,甚至可以直接通过jar包而非war包的形式就能够实现快速部署,不必再依赖于外部的Servlet容器。
3. yml配置的支持。yml或是yaml的全称是YAML Ain't Markup Language的简称(有意思的是,当初在开发这门语言时,其简称实际上是Yet Another Markup Language),新的简称采取了递归的方式。这种新的语言可以看作是传统的properties配置文件的一种有益补充,它通过缩进的方式来表示层次化的配置项,相比于传统的properties属性文件来说,其层次感会更好一些;当然,顺便也可以让我们少敲一些字母。
4. 提供了各种starter便于功能的开箱即用。围绕着Spring Boot生态圈目前已经涌现出了不计其数的starter,这样我们只需将相应的starter配置项引入到项目中即可很方便地使用对应的功能。
提供了各种度量。Spring Boot提供了各种度量属性,便于我们查看当前项目
的运行情况以及系统使用情况。
Spring Boot所提供的功能非常之多,上面不过是列举出了它诸多功能的几个方面而已。
Spring Boot非常方便,简单,拿来就用。这是Spring Boot自身的优良特性给开发人员所带来的最大的一个误解。
对于Spring Boot来说,显然它采取的是第一种策略,即将复杂性封装起来,向使用者暴露简单的接口,让开发者能够快速上手。
但显然,我们所开发的系统不可能是那么简单的,它或多或少地需要使用很多其他很多技术,当这些技术被集成到Spring Boot中时,很多问题就开始暴露出来了,这时的你如果没有扎实的基础,就会陷入遇到一个问题就到处搜结果的窘境,结果造成一天下来疲于搜索答案。经过了一段时间,你可能会反问自己:这是我要的Spring Boot么?怎么感觉还不如使用传统的Spring MVC开发速度快呢?
当我们使用传统的开发模式时,大多数内容都是我们自己来设置的;在这种情况下,系统出现了问题后,我们能够比较快地定位到问题所在;然而,在Spring Boot中,因为一切都是自动装配的,因此一旦出现问题,定位问题就是一个非常耗时耗力的事情。
Spring Boot的配置方式简单,更加优越。我相信,这也是很多开发者在使用Spring Boot时所得出的一个结论。但是,我想问题的是,YAML真的就比properties强大很多么(当然,Spring Boot对于这两种方式都是支持的)。如果你的配置项很多,而且都放到了l中时(特别地,将各种profile配置也都放到了这里),那你再来看看你的yml文件,你还会有良好的心情么?
Spring Boot项目一旦出现问题,特别是那种自动配置出现问题,或是同一个类型有几个对应项时,排查起来不是那么容易的事情,尤其在项目规模比较庞大时更是如此。这就需要你对Spring Boot的底层有良好的掌握与认知才能较快地出问题所在。
配置的加载。我相信很多做Spring Boot开发的程序员们都读过网上关于Spring Boot配置信息加载优先级的文章。姑且不论这些文章的正确与否,你是否真正理解了配置信息优先级问题,Spring Boot是如何处理配置信息的加载优先级的。
附录B 外文翻译—译文部分
There is no doubt that Spring Boot is a very special place among many programmers working on Java microservices development. It's especially because it really simplifies the application/microservice development process based on the Spring technology stack, so that we can quickly build an application scaffolding and develop projects on it, no longer need to use it as before. A large amount of XML or annotations, the application can be created as quickly as possible under such premise that the configuration is better than the configuration.
Spring Boot has greatly liberated developers from this point, freeing developers from the tedious configuration of the previous, and instead focused on the application of business logic development.
In this way, the development cycle of our system will be greatly shortened, and the delivery cycle will be more and more frequent. This is also the great benefit that Spring Boot brings to our developers. We can enjoy the functions brought by such a good framework in all aspects, and even many functions can be used out of the box, just configure it in POM adle, compared to the previous Spring. Traditional web development models such as MVC have simplified too much.
In general, Spring Boot brings us tremendous performance improvements in the following areas:
The convention is better than the configuration. After simple configuration in Spring Boot mode, the functions can be used directly.
1. Automatic assembly. Spring Boot automatically detects various types under the classpath at startup, and implements automatic assembly of types. It does not require developers to perform explicit type assembly via XML or annotations. This is subject **************************************************@SpringBootApplication annotation is given.
Embed various Servlet containers.springboot推荐算法
2. Spring Boot embeds Servlet containers such as Tomcat, Jetty and Undertow, so that we can start t
he container directly through the main method just like developing a normal Java application, or even directly through the jar package instead of the war package. Deploy, no longer have to rely on external servlet containers.
3. Support for yml configuration. The full name of yml or yaml is short for YAML Ain't Markup Language (interestingly, when the language was originally developed, the abbreviation is actually Yet Another Markup Language), the new abbreviation takes a recursive approach. This new language can be seen as a useful complement to the
traditional properties configuration file, which represents the hierarchical configuration items by indentation. Compared to the traditional properties property file, the layering will be more Better; of course, by the way, we can knock out some letters.
4. Provides a variety of starter functions for out of the box. Around the Spring Boot ecosystem, there are countless starters, so we only need to introduce the corresponding starter configuration items into the project to easily use the corresponding functions. Various metrics are provided. Spring Boot provides a variety of metric properties that allow us to view the current project's operation and system usage.
Spring Boot provides a lot of features, but it lists just a few of its many features.
Spring Boot is very convenient, simple, and used. This is the biggest misunderstanding that developers have brought to the best of Spring Boot's own features.
For Spring Boot, it's clear that it's the first strategy that wraps the complexity and exposes simple interfaces to the consumer, allowing developers to get started quickly.
But obviously, the system we developed can't be so simple. It needs to use many other technologies more or less. When these technologies are integrated into Spring Boot, many problems begin to be exposed. If you don't have a solid foundation, you will fall into the dilemma of searching for results when you encounter a problem. As a result, you will be tired of searching for answers one day. After a while, you may ask yourself: Is this Spring Boot I want? How do you feel that it is not as fast as using traditional Spring MVC?
When we use the traditional development model, most of the content is set by ourselves; in this case, after the system has a problem, we can locate the problem relatively quickly; however, in Spring Boot, because Everything is automatically assembled, so positioning problems is a very time consuming and labor intensive problem.
Spring Boot is simple and superior. I believe that this is also a conclusion that many developers get when using Spring Boot. However, I think the problem is that YAML is really more powerful than properties (of course, Spring Boot supports both methods). If you have a lot of configuration items and put them l (in particular, put all the profile configurations here), then you can look at your yml file, you will have a good mood? ?
Once there is a problem with the Spring Boot project, especially if there is a problem with automatic configuration, or if there are several corresponding items for the same type, it is not so easy to troubleshoot, especially when the project size is large. This requires you to have a good grasp and understanding of the underlying Spring
Boot to find out the problem faster.
Configuration loading. I believe that many programmers who have done Spring Boot development have read the article on the Spring Boot configuration information loading priority. Regardless of whether these articles are correct or not, do you really understand the priority of configuration information, and how Spring Boot handles the loading priority of configuration information.

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。