zoukankan      html  css  js  c++  java
  • Spring Boot的快速创建

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

    创建一个controller

    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项目:

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

    2、resource文件夹目录结构

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

              可以修改一些默认的配置

  • 相关阅读:
    [算法] 带权图
    哥德巴赫猜想 ——— 极限算法(你要是能写出比我用时还短的代码算我输)
    详解 位运算
    内存对齐模式 —— 原理讲解
    C语言 文件操作
    指针与数组
    队列的实现
    堆栈的实现
    线性表 详讲及使用
    树莓派
  • 原文地址:https://www.cnblogs.com/hoje/p/10736683.html
Copyright © 2011-2022 走看看