11. Developing Your First Spring Boot Application(部署你的第一个Spring Boot应用)
1 | This section describes how to develop a simple “Hello World!” web |
本节讲述了如何部署一个简单的”Hello World”的Web应用,突出讲述了一些Spring Boot的关键功能。我们使用Maven去构建这个工程,因为大多数IDE支持它。
1 | The spring.io web site contains many “Getting Started” guides that |
spring.io网站包含了很多使用Spring Boot的“入门”向导。如果你需要解决一个特殊的问题,可以首先从那里寻找答案。您可以通过start.spring.io从依赖中找到“Web starter”来简化以下步骤。这样做会产生一个新的项目结构,以便您可以立即开始编码。查看Spring Initializr文档以获取更多详细信息。
1 | Before we begin, open a terminal and run the following commands |
在我们开始之前,打开terminal窗口,运行以下指令去确认您是否安装有符合版本的java和maven1
2
3
4$ java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
1 | $ mvn -v |
This sample needs to be created in its own folder. Subsequent
instructions assume that you have created a suitable folder and
that it is your current directory.
此示例需要在其自己的文件夹中创建。随后说明假定您已经创建了合适的文件夹和
它是你当前的目录。