简单快速搭建一个springBoot的web项目
创建一个项目
删除临时文件
程序的主入口
简单写一个demo
package com.sxt.demo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("hello")
public class HelloController {
@RequestMapping("index")
public String index(){
return "hello!world!";
}
@RequestMapping("login")
@ResponseBody
public Object login(){
Map map = new HashMap();
map.put("name","zyd");
map.put("addr","shuaiqi");
return map;
}
}
配置端口以及其他信息
搭建完成