static:存放静态文件,比如 css、js、image (本项目前后分离不涉及此目录) templates:存放页面,比如 jsp、html、tpl (本项目前后分离不涉及此目录) application.properties等 配置文件名称 Application.java 项目启动类 三、SpringBoot项目研发 1、配置application.properties 配置启动端口(默认为8080)、项目名称 server.por...
spring.thymeleaf.prefix=classpath:/templates/ 配置项好之后,那么就剩下实现了。 而模板文件时要放到tempates里面的,所以要先在类路径下面创建这个文件夹,然后在说其他的。如下: 接下来写写怎么呈现集成成功。 这个是home.html,放在webapp下面,因为都可以通过项目来跳级访问资源,所以放在templates下面的那些模板文件...
1 创建springboot项目 2 建立templates文件夹 3在pom 导入模板引擎的依赖 4 因为这个模板引擎是导入的依赖,那么一定有自动配置类,记住,只要是pom导入的东西,一定是有自动配置类的。现在我们看这个模板引擎的自动配置的类 双击shift ,全局查找这个配置类 根据这个源码,在templates这个文件夹下,要有以html结尾的文件。...
templates目录为spring boot默认配置的动态页面路径 代码语言:javascript 复制 packagehello;importjavax.servlet.http.HttpServletRequest;importorg.springframework.stereotype.*;importorg.springframework.web.bind.annotation.*;@ControllerpublicclassTemplatesController{@GetMapping("/templates")Stringtest(HttpServletRequest ...
spring.devtools.restart.exclude:templates/** 3、IDEA配置自动编译 当我们修改了Java类后,IDEA默认是不自动编译的,而spring-boot-devtools又是监测classpath下的文件发生变化才会重启应用,所以需要设置IDEA的自动编译: (1)File-Settings-Compiler-Build Project automatically ...
SpringBoot配置freemarker非常简单,我们只用在pom中添加freemarker依赖就ok了,SpringBoot默认的freemarker的页面位置位于 /src/main/resources/templates下面 首先添加依赖 <projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.ap...
springboot templates文件夹 SpringBoot 1.X 版本和 SpringBoot 2.X 版本在静态资源访问上有一些区别,如果直接从 1.X 升级到 2.X 肯定是有问题的。这篇文章就来讲讲这方面问题,也是项目中的坑。 先看看项目结构,这个项目主要是开发商管理系统,包含了开发商信息,开发商订单等模块。主要介绍 resources 目录,...
|-templates 模板文件 html mybatis-generator.properties MBG 代码生成器配置文件 mybatis-generator.xml MBG 代码生成器配置文件 |-test 测试用例 |-java |-com.brtbeacon.example.test 测试用例包名 package.xml 打包配置文件 .gitignore 版本控制忽略配置文件 ...
1. 在pom.xml中配置Java版本: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.6</version> <configuration> 1.8 <target>1.8</target> </configuration> </plugin> 2. 在pom.xml中设置...
001 # === 002 # COMMON SPRING BOOT PROPERTIES 003 # 004 # This sample file is provided as a guideline. Do NOT copy it in its 005 # entirety to your own application. ^^^ 006 # === 007 008 # ---