启动idea,创建一个新项目
可以自己手动导入一些包,也可以直接next
finish
修改一下依赖,将
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
修改为
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
写一个页面
package com.noc.springboot00.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
@GetMapping("/test")
public String test1(){
return "hello SpringBoot";
}
}
启动
而后打开浏览器输入网址 localhost:8080/test