springboot模板
文章目录 Thymeleaf模板 Freemarker模板 Thymeleaf包含公共区域的两种方案: Thymeleaf模板 1.相关依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> 2.Spring Boot官方文档建议在开发时将缓存关闭,那就在application.properties文件中加入下面这行 注:在一般开发中,我们习惯于将application.properties更换为application.yml,因为这种的话,在application中写代码会自动产生层级结构,更加容易看清 server: port: 80 servlet: context-path: / # 关闭缓存thymeleaf,等待正式运行时开启 spring: thymeleaf: cache: false 3.为了前台代码使用方便,我们将加入下面这行代码: <caption th:utext="${a}"></caption> 4.新建一个user类: package com.swx.springboot01.entity; import lombok.Data; /** *