新建工程

选择spring-boot版本

右键创建类TestController:

代码如下:
package com.example.demo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/liupeng")
public class TestController {
@GetMapping("/hello")
public String TestHelloworld()
{
return "hello world";
}
}运行启动后台,输入网址测试:
http://127.0.0.1:8080/liupeng/hello










