spring-boot - 我如何在春季启动中为百里香设置前缀路径
问题描述
如何设置前缀路径(设置新目录)来呈现 HTML 页面?
我有一个弹簧启动应用程序。我使用的是 2.1.7 版。
- 我为查看页面设置了新路径。
解决方案
在 Application.properties 中添加以下行
spring.thymeleaf.check-template-location=true
spring.thymeleaf.prefix=classpath:/templates/views/ #this is the main
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.cache=false
spring.main.allow-bean-definition-overriding=true
推荐阅读
- python - 实施“。”的原因。作为当前工作目录的表示
- r - 有没有办法根据两列删除重复项,但在第三列中保留数字最高的列?
- reactjs - 在 Jest 中注入多个模拟上下文
- python - 如何在 python numpy 中引发 nan 值的错误
- firebase - 在 Flutter 中使用 GetX 使用 Image Picker 和 Cropper 后如何显示图像?
- python - Pandas groupby.agg 在传递额外参数时无法处理返回的元组
- .net - 通过 TCP/IP 在 vxWorks 应用程序和 .net 桌面应用程序之间进行进程间通信的最佳方式
- ssis - 使用正确函数时使用大小写的 SSIS 子字符串错误
- php - 莱佛士的 PHP 竞赛条件
- c - C socket Client 在不知道 IP 地址的情况下与 LAN 外的 Server 通信