Skip to content

Allow must-revalidate to be suppressed in ResourceHttpRequestHandler [SPR-10464] #15097

Closed
@spring-projects-issues

Description

@spring-projects-issues

Neale Upstone opened SPR-10464 and commented

I'd like the following code snippet to be able to work, but I cannot set alwaysMustRevalidate:

@Configuration
@EnableWebMvc
public class ResourcesServletConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private ResourceVersionSource versionSource;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        String cachebustPaths = "/" + versionSource.getVersion() + "/**";

        registry.addResourceHandler(cachebustPaths)
                .addResourceLocations("/")
                .setCachePeriod(365 * 24 * 3600)
                .setMustRevalidate(false);
    }
}

I would be good to have control over other properties of WebContentGenerator too, hence the +others in the summary.


Affects: 3.2.2

This issue is a sub-task of #16413

Referenced from: commits 38f32e3

9 votes, 13 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: taskA general task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions