1
2
3
4
5
配置文件
application.yaml
server:
servlet:
context-path: /app #项目名
controller
//注入到spring容器
@Controller
public class HelloController {
@GetMapping("hello")
@ResponseBody
public String hello(){
return "Hello,SpringBoot";
}
}
启动项目
@SpringBootApplication
public class SpringbootDemo1Application {
public static void main(String[] args) {
SpringApplication.run(SpringbootDemo1Application.class, args);
}
}