在 spring 中为特定文件/文件夹设置缓存控制

Ada*_*dam 5 spring spring-mvc cache-control

在 5.2.9 spring 项目中

<mvc:resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>
Run Code Online (Sandbox Code Playgroud)

在 webmvc-config.xml 中。静态图像与标题一起提供cache-control: /*omissions */ no-cache。我正在尝试覆盖特定文件或文件夹的此标头。

<mvc:resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**">
    <mvc:cache-control max-age="3600" cache-public="true"/>
</mvc:resources>
Run Code Online (Sandbox Code Playgroud)

如果我替换为上面的内容,它会按我想要的方式工作,但它针对所有文件。我尝试更具体一些,例如:

<mvc:resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>

<mvc:resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/myImages/**">
    <mvc:cache-control max-age="3600" cache-public="true"/>
</mvc:resources>
Run Code Online (Sandbox Code Playgroud)

但我不认为它喜欢有两个资源标签?我在文档中没有看到明确的方法来执行我想要的操作,但我对该领域不太熟悉。我不认为我想要一个“拦截器”?