• springbootthymeleaf 快速开发模板


    idea springboot initializr 创建springboot项目

    填好项目的基本信息maven

    选择你需要依赖模块




    下一步后等待下载~

    若还需要再次依赖别的jar包,可以在下面地址找

        https://mvnrepository.com/
    

    在application.properties(yml)填写必要信息

    server:
      port: 8080
    ### 需要别的也可以找
    

    resources/templates 文件夹下编写index.html编写前端页面

    默认boot会放行该文件夹下的静态以 html结尾的文件

    <!DOCTYPE html>
    <html xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <title>abc</title>
        <link th:href="@{/webjars/bootstrap/4.4.1/css/bootstrap.css}">
        <link th:href="@{/webjars/jquery/3.4.1/jquery.js}">
    </head>
    <body>
    hello
    </body>
    </html>
    

    引入前端的文件,boot推荐使用webjars来引入前端的文件,可以在下面地址找需要的前端样式和js文件,在maven,pom文件中添加

    https://www.webjars.org/
    

    引用的话类似于这样子

        <link th:href="@{/webjars/bootstrap/4.4.1/css/bootstrap.css}">
        <link th:href="@{/webjars/jquery/3.4.1/jquery.js}">
    

    在项目下的位置

    之后是热部署工具配置idea

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
    


    完毕~

  • 相关阅读:
    一、【注解】Spring注解@ComponentScan
    一致性Hash算法
    垃圾回收器搭配和调优
    JVM的逃逸分析
    简单理解垃圾回收
    类加载机制和双亲委派模型
    VMWare15下安装CentOS7
    HBase协处理器(1)
    依赖注入的三种方式
    Javascript-设计模式_装饰者模式
  • 原文地址:https://www.cnblogs.com/iullor/p/12205963.html
Copyright © 2020-2023  润新知