一、利用向导快速搭建Spring Boot应用

Spring Boot的快速创建 随笔 第1张Spring Boot的快速创建 随笔 第2张Spring Boot的快速创建 随笔 第3张Spring Boot的快速创建 随笔 第4张

创建一个controller

Spring Boot的快速创建 随笔 第5张

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

 

Spring Boot的快速创建 随笔 第6张
package com.hoje.springboot.Controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/*@RequestBody
@Controller*/
@RestController
public class HelloController {
    @RequestMapping("/hello")
    public  String hello(){
      return "hello world quick";
    }
}
HelloController

 Spring Boot的快速创建 随笔 第8张

默认生成的Spring Boot项目:

1、主程序已经生成好了,只需要添加我们自己的逻辑;

2、resource文件夹目录结构

  • static :保存所以的静态资源:js css images;
  • templates:保存所以的模板页面:(Spring Boot默认jar包使用嵌入式Tomcat,默认不支持JSP页面,可以使用模板引擎(freemaker,thymeleaf));
  • application.properties:Spring Boot应用的配置文件;
server.port=8081

          可以修改一些默认的配置

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄