|
25 | 25 |
|
26 | 26 | import org.springframework.beans.factory.ListableBeanFactory; |
27 | 27 | import org.springframework.beans.factory.ObjectProvider; |
28 | | -import org.springframework.beans.factory.annotation.Autowired; |
29 | 28 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
30 | 29 | import org.springframework.boot.autoconfigure.AutoConfigureOrder; |
31 | 30 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
|
57 | 56 | import org.springframework.web.filter.reactive.HiddenHttpMethodFilter; |
58 | 57 | import org.springframework.web.reactive.config.DelegatingWebFluxConfiguration; |
59 | 58 | import org.springframework.web.reactive.config.EnableWebFlux; |
60 | | -import org.springframework.web.reactive.config.ResourceChainRegistration; |
61 | 59 | import org.springframework.web.reactive.config.ResourceHandlerRegistration; |
62 | 60 | import org.springframework.web.reactive.config.ResourceHandlerRegistry; |
63 | 61 | import org.springframework.web.reactive.config.ViewResolverRegistry; |
64 | 62 | import org.springframework.web.reactive.config.WebFluxConfigurationSupport; |
65 | 63 | import org.springframework.web.reactive.config.WebFluxConfigurer; |
66 | | -import org.springframework.web.reactive.resource.AppCacheManifestTransformer; |
67 | | -import org.springframework.web.reactive.resource.EncodedResourceResolver; |
68 | | -import org.springframework.web.reactive.resource.ResourceResolver; |
69 | | -import org.springframework.web.reactive.resource.VersionResourceResolver; |
70 | 64 | import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; |
71 | 65 | import org.springframework.web.reactive.result.method.annotation.ArgumentResolverConfigurer; |
72 | 66 | import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter; |
@@ -277,54 +271,4 @@ public ResourceChainResourceHandlerRegistrationCustomizer resourceHandlerRegistr |
277 | 271 |
|
278 | 272 | } |
279 | 273 |
|
280 | | - interface ResourceHandlerRegistrationCustomizer { |
281 | | - |
282 | | - void customize(ResourceHandlerRegistration registration); |
283 | | - |
284 | | - } |
285 | | - |
286 | | - static class ResourceChainResourceHandlerRegistrationCustomizer |
287 | | - implements ResourceHandlerRegistrationCustomizer { |
288 | | - |
289 | | - @Autowired |
290 | | - private ResourceProperties resourceProperties = new ResourceProperties(); |
291 | | - |
292 | | - @Override |
293 | | - public void customize(ResourceHandlerRegistration registration) { |
294 | | - ResourceProperties.Chain properties = this.resourceProperties.getChain(); |
295 | | - configureResourceChain(properties, |
296 | | - registration.resourceChain(properties.isCache())); |
297 | | - } |
298 | | - |
299 | | - private void configureResourceChain(ResourceProperties.Chain properties, |
300 | | - ResourceChainRegistration chain) { |
301 | | - ResourceProperties.Strategy strategy = properties.getStrategy(); |
302 | | - if (properties.isCompressed()) { |
303 | | - chain.addResolver(new EncodedResourceResolver()); |
304 | | - } |
305 | | - if (strategy.getFixed().isEnabled() || strategy.getContent().isEnabled()) { |
306 | | - chain.addResolver(getVersionResourceResolver(strategy)); |
307 | | - } |
308 | | - if (properties.isHtmlApplicationCache()) { |
309 | | - chain.addTransformer(new AppCacheManifestTransformer()); |
310 | | - } |
311 | | - } |
312 | | - |
313 | | - private ResourceResolver getVersionResourceResolver( |
314 | | - ResourceProperties.Strategy properties) { |
315 | | - VersionResourceResolver resolver = new VersionResourceResolver(); |
316 | | - if (properties.getFixed().isEnabled()) { |
317 | | - String version = properties.getFixed().getVersion(); |
318 | | - String[] paths = properties.getFixed().getPaths(); |
319 | | - resolver.addFixedVersionStrategy(version, paths); |
320 | | - } |
321 | | - if (properties.getContent().isEnabled()) { |
322 | | - String[] paths = properties.getContent().getPaths(); |
323 | | - resolver.addContentVersionStrategy(paths); |
324 | | - } |
325 | | - return resolver; |
326 | | - } |
327 | | - |
328 | | - } |
329 | | - |
330 | 274 | } |
0 commit comments