Closed
Description
Given current efficiency impact of webjars-locator-core
(see this related comment), an its incompatibility with native images, it makes sense to recommend to use versioned URLs with this kind of configuration instead of WebJarsResourceResolver
without including webjars-locator-core
dependency in Spring reference documentation.
@Bean
public WebMvcConfigurer configurer() {
return new WebMvcConfigurer() {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:META-INF/resources/webjars/");
}
};
}
We can refine later recommending the regular webjars-locator-core
+ WebJarsResourceResolver
approach with version-less URLs if/when webjars-locator-core
implement resource resolution without scanning, which seems to be possible as experimented in #27619.