创建项目:
引用web依赖即可
使用:
创建类,即可启动
package com.example.demo.control; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class Control { @RequestMapping(value = "hi") public String sayhi(){ return "hellow"; } }
配置文件:
在 src\main\resources 床架application.yml ,IDEA会自动加载配置文件
server: port: 9090 servlet: context-path: /boot #设置虚拟目录 # path: "*.html" #没有成功