Spring boot 第一个程序

阅读 25

2023-09-30


新建工程

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)

0 0 举报