Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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 MVC WebContent Interceptor没有用于静态内容的缓存_Spring_Spring Mvc_Caching - Fatal编程技术网

Spring MVC WebContent Interceptor没有用于静态内容的缓存

Spring MVC WebContent Interceptor没有用于静态内容的缓存,spring,spring-mvc,caching,Spring,Spring Mvc,Caching,使用WebContentInterceptor,我在客户端启用了缓存机制 但正如您所看到的,父(resources/)文件夹下的一些文件夹应该 被缓存,而其他一些不应被缓存 起初我只是使用了这个配置 <mvc:interceptor> <mvc:mapping path="/resources/**" /> <mvc:exclude-mapping path="/resources/js/project/**" />

使用WebContentInterceptor,我在客户端启用了缓存机制

但正如您所看到的,父(resources/)文件夹下的一些文件夹应该 被缓存,而其他一些不应被缓存

起初我只是使用了这个配置

<mvc:interceptor>
        <mvc:mapping path="/resources/**" />

        <mvc:exclude-mapping path="/resources/js/project/**" />
        <mvc:exclude-mapping path="/resources/css/project/**" />
        <mvc:exclude-mapping path="/resources/images/users/**" />

        <bean id="webContentInterceptor"
            class="org.springframework.web.servlet.mvc.WebContentInterceptor">
            <property name="cacheSeconds" value="2592000" />
            <property name="useExpiresHeader" value="true" />
            <property name="useCacheControlHeader" value="true" />
            <property name="useCacheControlNoStore" value="true" />
        </bean>
    </mvc:interceptor>

按照我的逻辑,我缓存了所有文件夹,但排除了不需要缓存的文件夹。 但它不起作用。所以我已经配置了这样的东西

<mvc:interceptor>
        <mvc:mapping path="/resources/js/project/**" />
        <mvc:mapping path="/resources/css/project/**" />
        <mvc:mapping path="/resources/images/users/**" />

        <bean id="webContentInterceptorNoCache"
            class="org.springframework.web.servlet.mvc.WebContentInterceptor">
            <property name="cacheSeconds" value="0" />
            <property name="useExpiresHeader" value="true" />
            <property name="useCacheControlHeader" value="true" />
            <property name="useCacheControlNoStore" value="true" />
        </bean>
    </mvc:interceptor>
    <mvc:interceptor>
        <mvc:mapping path="/resources/**" />

        <mvc:exclude-mapping path="/resources/js/project/**" />
        <mvc:exclude-mapping path="/resources/css/project/**" />
        <mvc:exclude-mapping path="/resources/images/users/**" />

        <bean id="webContentInterceptor"
            class="org.springframework.web.servlet.mvc.WebContentInterceptor">
            <property name="cacheSeconds" value="2592000" />
            <property name="useExpiresHeader" value="true" />
            <property name="useCacheControlHeader" value="true" />
            <property name="useCacheControlNoStore" value="true" />
        </bean>
    </mvc:interceptor>

认为第一个拦截器可以消除咯咯声。但它也不起作用

我甚至试着看不到缓存头

 <mvc:interceptor>
        <mvc:mapping path="/resources/**" />

        <bean id="webContentInterceptor"
            class="org.springframework.web.servlet.mvc.WebContentInterceptor">
            <property name="cacheSeconds" value="0" />
            <property name="useExpiresHeader" value="true" />
            <property name="useCacheControlHeader" value="true" />
            <property name="useCacheControlNoStore" value="true" />
        </bean>
    </mvc:interceptor>

还是没有机会

我做错什么了吗?你能帮我吗