我已经使用了带有 Thymeleaf 的 spring boot(添加了 thymeleaf starter 依赖项)。
css文件放在下面src/main/resources/static
,html文件放在下面src/main/resources/templates
spring 主类用@SpringBootApplication
(像往常一样)注释。
在第一个控制器中说/ui
,我正在返回 index.html。它加载 CSS。
在 Url“ui/video/viewAll”的方法中说,我正在返回abc.html
(带有内容片段概念 - 使用 index.html 的相同布局。似乎只为这个 html 加载了 css 文件。
不知道为什么会出现这种行为?谁能解释为什么会这样?