Spring 4 addResourceHandlers

时间:2015-01-23 06:31:10

标签: java spring config

使用spring 4.1.1.RELEASE以下工作:

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{          registry.addResourceHandler("/css/**").addResourceLocations("/css/**").setCachePeriod(31556926);
    registry.addResourceHandler("/img/**").addResourceLocations("/img/**").setCachePeriod(31556926);
    registry.addResourceHandler("/js/**").addResourceLocations("/js/**").setCachePeriod(31556926);
    registry.addResourceHandler("/bootstrap/**").addResourceLocations("/bootstrap/**").setCachePeriod(31556926);
    registry.addResourceHandler("/jquery/**").addResourceLocations("/jquery/**").setCachePeriod(31556926);
    registry.addResourceHandler("/files/**").addResourceLocations("/files/**");
}

但是,当我升级到4.1.4时,我获得了所有这些资源的404。

为什么会出现这种情况?

0 个答案:

没有答案