Getting Started
创建新项目就像键入 spring boot new my-app
一样简单:
Creating a new project is as simple as typing spring boot new my-app
:
spring boot new my-app
输出为
The output is
Cloning project from https://github.com/rd-1-2022/rest-service
Created project in directory 'my-app'
如果 CLI 似乎卡在克隆步骤,则您可能会受到 GitHub 速率限制的影响。使用 |
If the CLI seems to be stuck at the cloning step, you might be hitting GitHub rate limiting. Use the |
你现在可以 cd
到 my-app
目录中并构建和运行应用程序,它在默认情况下是一个具有单个端点的简单 Web 应用程序:
You can now cd
into the my-app
directory and build and run the application, which is, by default, a simple web application with a single endpoint:
cd my-app
./mvnw spring-boot:run
然后,在另一个终端窗口中,您可以使用 curl 与端点进行交互:
Then, in another terminal windows, you can interact with the endpoint by using curl:
curl http://localhost:8080/greeting
curl 命令返回默认的“Hello World”问候语:
The curl command returns the default 'Hello World' greeting:
{"id":1,"content":"Hello, World!"}
新项目中的 README.adoc 文件包含有关该 Web 应用程序的工作原理的更多信息。
The README.adoc file in the new project contains more information on how the web applications works.
Next steps
Creating New Projects部分将向您展示如何创建除默认应用之外的其他应用。
The Creating New Projects section shows you how to create applications other than the default application.
Adding To Existing Projects节会向您展示如何将其他应用添加到当前的工作项目中。
The Adding To Existing Projects section shows you how to add additional applications into your current working project.