如何设置Spring Boot项目中Freemarker模板的加载路径?
- 内容介绍
- 文章标签
- 相关推荐
本文共计325个文字,预计阅读时间需要2分钟。
1. 使用Eclipse时,曾通过以下路径加载Spring Boot和Freemarker模板: - `src/main/resources/templates`
2. 现切换到IDEA后,无法使用相同方式,以下为三种加载Freemarker模板的方法: - `public void setClassForTemplateLoading(Class clazz, String prefix)`
1,之前用的eclipse开发工具来加载spring boot加载freemarker模板路径,现在换用idea却不能使用了,所以来记录一下
加载freemarker模板三种方式,如下
public void setClassForTemplateLoading(Class clazz, String pathPrefix); public void setDirectoryForTemplateLoading(File dir) throws IOException; public void setServletContextForTemplateLoading(Object servletContext, String path);
看名字也就知道了,分别基于类路径、文件系统以及Servlet Context。
本文共计325个文字,预计阅读时间需要2分钟。
1. 使用Eclipse时,曾通过以下路径加载Spring Boot和Freemarker模板: - `src/main/resources/templates`
2. 现切换到IDEA后,无法使用相同方式,以下为三种加载Freemarker模板的方法: - `public void setClassForTemplateLoading(Class clazz, String prefix)`
1,之前用的eclipse开发工具来加载spring boot加载freemarker模板路径,现在换用idea却不能使用了,所以来记录一下
加载freemarker模板三种方式,如下
public void setClassForTemplateLoading(Class clazz, String pathPrefix); public void setDirectoryForTemplateLoading(File dir) throws IOException; public void setServletContextForTemplateLoading(Object servletContext, String path);
看名字也就知道了,分别基于类路径、文件系统以及Servlet Context。

