Spring boot快速入门官网:https://spring.io/quickstart
翻译:
What you’ll build
You will build a classic “Hello World!” endpoint which any browser can connect to. You can even tell it your name, and it will respond in a more friendly way.
你会建立什么
您将构建一个经典的“ Hello World!”。任何浏览器都可以连接到的端点。您甚至可以告诉它您的名字,它将以更友好的方式响应。What you’ll need
An Integrated Developer Environment (IDE)
Popular choices include IntelliJ IDEA, Spring Tools, Visual Studio Code, or Eclipse, and many more.
A Java™ Development Kit (JDK)
We recommend AdoptOpenJDK version 8 or version 11.
你需要什么
集成开发人员环境(IDE)
热门选择包括 IntelliJ IDEA,Spring Tools, Visual Studio Code, 或者Eclipse, 还有很多。
Java™开发套件(JDK)
我们推荐 采用OpenJDK 版本8或版本11。Step 1: Start a new Spring Boot project
步骤1:开始一个新的Spring Boot项目Use start.spring.io to create a “web” project. In the “Dependencies” dialog search for and add the “web” dependency as shown in the screenshot. Hit the “Generate” button, download the zip, and unpack it into a folder on your computer.
用 start.spring.io创建一个“web”项目。在“Dependencies”对话框中,搜索并添加“web”依赖关系,如屏幕截图所示。点击“Generate”按钮,下载压缩文件,并将其解压缩到计算机上的文件夹中。Projects created by start.spring.io contain Spring Boot, a framework that makes Spring ready to work inside your app, but without much code or configuration required. Spring Boot is the quickest and most popular way to start Spring projects.
创建项目的 start.spring.io 包含 Spring Boot,这是一个框架,可以使Spring准备在您的应用程序内部工作,而无需太多代码或配置。Spring Boot是启动Spring项目的最快,最受欢迎的方式。Step 2: Add your code
步骤2:添加您的代码Open up the project in your IDE and locate the DemoApplication.java file in the src/main/java/com/example/demo folder. Now change the contents of the file by adding the extra method and annotations shown in the code below. You can copy and paste the code or just type it.
在IDE中打开项目,然后在DemoApplication.java文件src/main/java/com/example/demo夹中找到文件。现在,通过添加以下代码中所示的额外方法和注释来更改文件的内容。您可以复制并粘贴代码,也可以只键入代码。

package com.example.demo;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.RestController;@SpringBootApplication@RestControllerpublic class DemoApplication {public static void main(String[] args) {SpringApplication.run(DemoApplication.class, args);}@GetMapping("/hello")public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {return String.format("Hello %s!", name);}}```java
在这里插入代码片

The hello() method we’ve added is designed to take a String parameter called name, and then combine this parameter with the word “Hello” in the code. This means that if you set your name to “Amy” in the request, the response would be “Hello Amy”.
我们添加的方法hello()采用名为的String参数name,然后将此参数与"Hello"代码中的单词组合。这意味着,如果您“Amy”在请求中将姓名设置为,则响应为“Hello Amy”。The @RestController annotation tells Spring that this code describes an endpoint that should be made available over the web. The @GetMapping(“/hello”) tells Spring to use our hello() method to answer requests that get sent to the http://localhost:8080/hello address. Finally, the @RequestParam is telling Spring to expect a name value in the request, but if it’s not there, it will use the word “World” by default.
@RestController注解告诉Spring,这段代码描述了一个应该在web上可用的端点。@GetMapping(“/hello”)告诉Spring使用我们的hello()方法来回答被发送到http://localhost:8080/hello的请求。最后,@RequestParam告诉Spring 在请求中需要一个name值,但是如果不存在,默认情况下它将使用单词“ World”。Step 3: Try it
步骤3:尝试Let’s build and run the program. Open a command line (or terminal) and navigate to the folder where you have the project files. We can build and run the application by issuing the following command:
让我们构建并运行该程序。打开命令行(或终端),然后导航到您拥有项目文件的文件夹。我们可以通过发出以下命令来构建和运行该应用程序:

You should see some output that looks very similar to this:
您应该看到一些与此非常相似的输出:

The last couple of lines here tell us that Spring has started. Spring Boot’s embedded Apache Tomcat server is acting as a webserver and is listening for requests on localhost port 8080. Open your browser and in the address bar at the top enter http://localhost:8080/hello. You should get a nice friendly response like this:
最后两行告诉我们Spring已经开始。Spring boot的嵌入式Apache Tomcat服务器充当web服务器,并监听本地主机端口8080上的请求。打开浏览器,然后在顶部的地址栏中输入http:// localhost:8080/hello。您应该得到一个很好的友好响应,如下所示:

Spring boot快速入门:https://spring.io/quickstart网址翻译相关推荐

  1. boot入门思想 spring_什么是Spring boot?Spring Boot快速入门以及Spring Boot实例教程

    转自:http://www.jianshu.com/p/d24bceea7665 简介 在您第1次接触和学习Spring框架的时候,是否因为其繁杂的配置而退却了?在你第n次使用Spring框架的时候, ...

  2. spring boot 快速入门

    文章来源:https://www.cnblogs.com/junyang/p/8151802.html spring boot入门 -- 介绍和第一个例子 "越来越多的企业选择使用sprin ...

  3. 【720开发】 spring boot 快速入门

    spring boot 快速入门 通过构建简单的REST应用,了解spring boot的开发基本流程,验证其简单.易用特性. 环境要求 Spring Boot 2.0.0.BUILD-SNAPSHO ...

  4. 视频教程-Spring boot快速入门-Java

    Spring boot快速入门 十年项目开发经验,主要从事java相关的开发,熟悉各种mvc开发框架. 王振伟 ¥12.00 立即订阅 扫码下载「CSDN程序员学院APP」,1000+技术好课免费看 ...

  5. 芋道 Spring Boot 快速入门

    点击上方"芋道源码",选择"设为星标" 做积极的人,而不是积极废人! 源码精品专栏 原创 | Java 2019 超神之路,很肝~ 中文详细注释的开源项目 RP ...

  6. 【转】Spring Boot快速入门

    为什么80%的码农都做不了架构师?>>>    简介 在您第1次接触和学习Spring框架的时候,是否因为其繁杂的配置而退却了?在你第n次使用Spring框架的时候,是否觉得一堆反复 ...

  7. Spring Boot快速入门(尚硅谷笔记)

    一.Spring Boot 入门 1.Spring Boot 简介 简化Spring应用开发的一个框架: 整个Spring技术栈的一个大整合: J2EE开发的一站式解决方案: 2.微服务 2014,m ...

  8. spring boot快速入门

    1.什么是SpringBoot 一个javaweb的开发框架,和SpringMVC类似,对比其他javaweb框架的好处,官方说是简化开发,约定大于配置, you can "just run ...

  9. 第一篇:Spring Boot 快速入门篇

    小技巧: Spring Boot 集成周边技术3部曲 1.pom文件引入maven依赖 2.配置文件中配置相关信息 3.启动类上加注解 一.Spring Boot 构建项目有2种方式: Maven 构 ...

最新文章

  1. 在有@Override方法上面会报错如下
  2. linux shell中 if else以及大于、小于、等于逻辑表达式介绍
  3. Vue学习之路1 小白起步
  4. linux安装mysql字符_Linux下MySQL的彻底卸载和安装配置字符集
  5. ElasticSearch 启动 exception 解决
  6. ATL中集合和枚举器
  7. Windows下MongoDB安装及配置
  8. 美团大脑 | 知识图谱的建模方法及其应用
  9. AppScan---web安全检测及分析工具使用教程
  10. echarts曲线太多卡顿怎么优化_光刻胶旋涂曲线如何获得?
  11. jinja Evnironment
  12. 男生学计算机怎么样,男生学计算机专业好不好?
  13. windows10如何查看硬盘序列号
  14. 语音合成 TTS 相关的一些总结
  15. 系统集成项目管理工程师(软考中级)—— 第二十二章 安全管理 笔记分享
  16. gpg invalid解决方法
  17. logit模型应用实例_最大似然估计(上)——离散选择模型之十
  18. git提交空目录的方法
  19. windows下MySQL修改root密码
  20. kmp总结(相关例题1. Simpsons’ Hidden Talents 2.Oulipo)

热门文章

  1. 最高法院关于婚姻案件诉讼程序的一些解答
  2. 微信小程序-文本与图片无法对齐
  3. 发邮件报Failed to send email: Could not connect to SMTP host: smtp.exmail.qq.com, port: 465, response:-1
  4. 如何科学合理得运用一天的时间
  5. 微积分 --- 欧拉数e的计算方法(个人学习笔记)
  6. other blogs
  7. 第 3 节 JavaScript高阶函数的使用、v-model、组件化
  8. html的双下划线的解决办法
  9. 自动化测试脚本--测试百度搜索Selenium
  10. uniapp 微信小程序 导航栏设置背景颜色字体颜色