原文链接地址:https://projects.spring.io/spring-boot/
Spring Boot
Takes an opinionated view of building production-ready Spring applications. Spring Boot favors convention over configuration and is designed to get you up and running as quickly as possible.
简单粗暴建立批量应用程序。Spring Boot喜欢配置文件,被设计于让你轻松,并且尽可能最快速启动(程序);
Features
- Create stand-alone Spring applications(创建独立的Spring程序)
- Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)(内嵌Tomcat,Jetty 或Undertow,不需要配置WAR包)
- Provide opinionated 'starter' POMs to simplify your Maven configuration(提供残暴的‘开始器’——POM来简化你的Maven配置)
- Automatically configure Spring whenever possible(如有需要,则自动配置Spring文件)
- Provide production-ready features such as metrics, health checks and externalized configuration(提供批量的特点,例如韵律学,健康监测和配置具象化)
- Absolutely no code generation and no requirement for XML configuration(绝对的无码和不需要XML配置文件)
Quick Start
The recommended way to get started using spring-boot in your project is with a dependency management system – the snippet below can be copied and pasted into your build. Need help? See our getting started guides on building with Maven and Gradle.
我们建议你在你的工程(project)中,依赖一些管理系统来开始使用Spring Boot,你可以在你的工程中复制下面的代码,如果你需要帮助,可以参考我们Maven或Gradle的开始操作指导;
在这个地方,你要选择下载的版本,是1.5.3还是其他的版本;
然后,还有一个要选择的就是使用Maven还是Gradle来管理你的依赖架包;
我下面的案例使用的是Maven 来管理我的Jar包;
这里有一个快速开始,在自己的IDEA中创建一个Maven项目,然后复制上面的代码。
然后,Maven就在后台开始下载jar包了;
因为Maven的jar包还没有下完,所以我的@Controller是红色的;
等我Maven下载完,resolve完必要的jar包,导包之后,@Controller就变正常了(黄色);
但是等我一运行,发现报错了;
报错原因很简单:
Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
不能够开始内置的WebApplicationContext,因为丢失了EmbededServletContainerFactory bean;因为EnableAutoConfiguration注释掉了,重新恢复成黄色注释就可以了;
之后导包就可以了;
控制台:
成功~
Spring Boot CLI(Spring Boot命令行界面)
Spring Boot ships with a command line tool that can be used if you want to quickly prototype with Spring. It allows you to run Groovy scripts, which means that you have a familiar Java-like syntax, without so much boilerplate code. Follow the instructions in our main documentation if you want to install the Spring Boot CLI.
如果你想快速使用Spring,你可以使用Spirng Boot的命令行工具。它允许你运行Groovy脚本,这意味着你会很熟悉Java一样的语法规则。没有太多的 样板代码。如果你想安装Spring Boot CLI,那就跟随你主文件的说明去操作;