-
快速创建一个项目
-
项目创建成功后,为保证代码整洁可以将一些不需要的文件删除
-
入门实践
1.创建一个包用于专门编写需在创建项目的包名下,代码编写如下:
package com.itzx.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//请求处理器
@RestController
public class HelloWorld {
@RequestMapping("/hello")
public String hello(){
System.out.printf("Hello 2024-07-10 黄昏_~");
return "Hello 2024-07-10 黄昏_~";
}
}
2.编写完成后启动 启动类下的main方法
3. 打开本地8080服务器跟上设置的对应路由/hello