首先通过IDEA创建springboot项目选择web模块,或者通过https://start.spring.io/ 去构建web项目, 这样就构建成功了:
创建HelloController
package com.zcw.zcw_springboot.zcw_springboot.controller
;
import org.springframework.web.bind.annotation.GetMapping
;
import org.springframework.web.bind.annotation.RestController
;
@RestController
public class HelloController {
@GetMapping("/hello")
public String hello(){
return
"hello,demo ";
}
}
测试