java – 从Jar文件中使用Thymeleaf模板
发布时间:2020-12-15 04:34:05 所属栏目:Java 来源:网络整理
导读:我有一个使用Thymeleaf作为视图引擎的 Spring-boot应用程序,我想使用部署的Jar之外的文件夹作为Thymeleaf模板的源,我设置了变量: spring.thymeleaf.prefix=classpath:/templates/ “/ templates /”旁边是带有HTML文件的Jar,但是我得到一个例外,即Thymeleaf
我有一个使用Thymeleaf作为视图引擎的
Spring-boot应用程序,我想使用部署的Jar之外的文件夹作为Thymeleaf模板的源,我设置了变量:
spring.thymeleaf.prefix=classpath:/templates/ “/ templates /”旁边是带有HTML文件的Jar,但是我得到一个例外,即Thymeleaf无法解析模板,我尝试了很多配置,例如: spring.thymeleaf.prefix=classpath:templates/ spring.thymeleaf.prefix=classpath:templates 等等,不是没有用.我做错了什么,甚至可能吗? 解决方法
好的,看起来像这样做的方法是使用文件URL设置值,如下所示:
spring.thymeleaf.prefix=file:./templates/ 它现在有效. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |