Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot Errorcontroller中的Thymeleaf静态资源版本控制_Spring Boot_Versioning - Fatal编程技术网

Spring boot Errorcontroller中的Thymeleaf静态资源版本控制

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

我正在尝试在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-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 ...>
...