我们将学习如何快速的创建一个Spring Boot应用,并且实现一个简单的Http请求处理。通过这个例子对Spring Boot有一个初步的了解,并体验其结构简单、开发快速的特性。
我的环境准备:
开发工具:
建议把服务连接换成阿里云的:https://start.aliyun.com/
package com.study.springboot01helloworld.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorld {
@RequestMapping("/hello")
public String HelloWorld01(){
return "HelloWorld";
}
}
1、启动完成提示
2、在网页中输入localhost:8080
3、在网页中输入localhost:8080/hello
原文:https://www.cnblogs.com/mengbingpeng1010/p/15037347.html