第一个SpringBoot程序
工具:
- jdk1.8
- maven 3.6.1
- springboot:最新版
- IDEA
使用方法
- 直接上官网
- 在IDEA里创建
注意事项
- SpringBootApplication是程序的主入口,不能删除
- application.properties核心配置文件
- localhost:8080直接启动,显示 /error 显示启动成功(没有文件)
- 在DemoApplication同级目录下添加文件夹,编写代码就是这里

代码编写
package com.example.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ye xin
*/
@RestController
public class DemoController {
//接口:http://localhost:8080/hello
@RequestMapping("/hello")
public String hello(){
//调用业务,接受前端参数
return "hello,world";
}
}