1.IDAE配置Maven
IDAE配置Maven的方法可以考这篇文章:https://blog.youkuaiyun.com/weixin_43721000/article/details/122826409
2.新建SpringBoot工程
1.File→New→Project
2.选择Spring Initializr 编辑下项目名和组织,点击next
3.选择Spring Web,点击finish
4.新建一个controller
内容如下
package com.cxstar.testspringboot.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/books")
public class BookController {
@GetMapping
public String findBook() {
return "《历史上的今天》";
}
}
5.启动SpringBoot
6.访问端口:http://127.0.0.1:8080/books