Spring boot Errorcontroller中的Thymeleaf静态资源版本控制
我正在尝试在ErrorController中进行资源版本控制。Spring boot Errorcontroller中的Thymeleaf静态资源版本控制,spring-boot,versioning,Spring Boot,Versioning,我正在尝试在ErrorController中进行资源版本控制。 所以,如果用户遇到类似403404的错误,我们将显示自定义HTML。 这个HTML有静态资源,如CSS、JavaScript。 但我面临的问题是 I can get resource files successfully. But resource versioning is not applied. get "/css/foo/bar.css" instead of "/css/foo/bar-0c5
所以,如果用户遇到类似403404的错误,我们将显示自定义HTML。
这个HTML有静态资源,如CSS、JavaScript。
但我面临的问题是
I can get resource files successfully.
But resource versioning is not applied.
get "/css/foo/bar.css" instead of "/css/foo/bar-0c532a5c87d2b7sdfg6s7d52b219f7.css"
当我直接访问错误页面时(“**/error”)已成功应用资源版本控制。
但当我通过“ErrorController”时,我有上述问题。
我错过了什么 下面是我的代码部分 MyErrorController.java
public class MyErrorController implements ErrorController {
@RequestMapping("/error")
public String handleError() {
//do something like logging
return "error";
}
}
application.yml
spring.resources.chain.strategy.content.enabled: true
spring.resources.chain.strategy.content.paths: /**
<link rel="stylesheet" type="text/css" th:href="@{/css/foo/bar.css}">
<link ...>
...
error.html
spring.resources.chain.strategy.content.enabled: true
spring.resources.chain.strategy.content.paths: /**
<link rel="stylesheet" type="text/css" th:href="@{/css/foo/bar.css}">
<link ...>
...