0
点赞
收藏
分享

微信扫一扫

Spring boot 第一个程序


新建工程

Spring boot 第一个程序_spring boot

选择spring-boot版本

Spring boot 第一个程序_后端_02

右键创建类TestController:

Spring boot 第一个程序_java_03

代码如下:

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

举报

相关推荐

0 条评论