Browse Source

Revert "Avoid deprecation warnings for WebJarsResourceResolver"

This reverts commit 61db499ae2.
pull/32889/head
Stéphane Nicoll 2 years ago
parent
commit
975e2f4218
  1. 8
      spring-webflux/src/main/java/org/springframework/web/reactive/config/ResourceChainRegistration.java
  2. 6
      spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java
  3. 8
      spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceChainRegistration.java

8
spring-webflux/src/main/java/org/springframework/web/reactive/config/ResourceChainRegistration.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2024 the original author or authors. * Copyright 2002-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -32,6 +32,7 @@ import org.springframework.web.reactive.resource.PathResourceResolver;
import org.springframework.web.reactive.resource.ResourceResolver; import org.springframework.web.reactive.resource.ResourceResolver;
import org.springframework.web.reactive.resource.ResourceTransformer; import org.springframework.web.reactive.resource.ResourceTransformer;
import org.springframework.web.reactive.resource.VersionResourceResolver; import org.springframework.web.reactive.resource.VersionResourceResolver;
import org.springframework.web.reactive.resource.WebJarsResourceResolver;
/** /**
* Assists with the registration of resource resolvers and transformers. * Assists with the registration of resource resolvers and transformers.
@ -92,8 +93,7 @@ public class ResourceChainRegistration {
else if (resolver instanceof PathResourceResolver) { else if (resolver instanceof PathResourceResolver) {
this.hasPathResolver = true; this.hasPathResolver = true;
} }
else if (resolver instanceof org.springframework.web.reactive.resource.WebJarsResourceResolver || else if (resolver instanceof WebJarsResourceResolver || resolver instanceof LiteWebJarsResourceResolver) {
resolver instanceof LiteWebJarsResourceResolver) {
this.hasWebjarsResolver = true; this.hasWebjarsResolver = true;
} }
return this; return this;
@ -121,7 +121,7 @@ public class ResourceChainRegistration {
result.add(new LiteWebJarsResourceResolver()); result.add(new LiteWebJarsResourceResolver());
} }
else if (isWebJarAssetLocatorPresent && !this.hasWebjarsResolver) { else if (isWebJarAssetLocatorPresent && !this.hasWebjarsResolver) {
result.add(new org.springframework.web.reactive.resource.WebJarsResourceResolver()); result.add(new WebJarsResourceResolver());
} }
result.add(new PathResourceResolver()); result.add(new PathResourceResolver());
return result; return result;

6
spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2024 the original author or authors. * Copyright 2002-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -53,6 +53,7 @@ import org.springframework.web.servlet.resource.ResourceTransformer;
import org.springframework.web.servlet.resource.ResourceUrlProvider; import org.springframework.web.servlet.resource.ResourceUrlProvider;
import org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor; import org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor;
import org.springframework.web.servlet.resource.VersionResourceResolver; import org.springframework.web.servlet.resource.VersionResourceResolver;
import org.springframework.web.servlet.resource.WebJarsResourceResolver;
/** /**
* {@link org.springframework.beans.factory.xml.BeanDefinitionParser} that parses a * {@link org.springframework.beans.factory.xml.BeanDefinitionParser} that parses a
@ -333,8 +334,7 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
if (isAutoRegistration) { if (isAutoRegistration) {
if (webJarsPresent) { if (webJarsPresent) {
RootBeanDefinition webJarsResolverDef = RootBeanDefinition webJarsResolverDef = new RootBeanDefinition(WebJarsResourceResolver.class);
new RootBeanDefinition(org.springframework.web.servlet.resource.WebJarsResourceResolver.class);
webJarsResolverDef.setSource(source); webJarsResolverDef.setSource(source);
webJarsResolverDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); webJarsResolverDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
resourceResolvers.add(webJarsResolverDef); resourceResolvers.add(webJarsResolverDef);

8
spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceChainRegistration.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2024 the original author or authors. * Copyright 2002-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -32,6 +32,7 @@ import org.springframework.web.servlet.resource.PathResourceResolver;
import org.springframework.web.servlet.resource.ResourceResolver; import org.springframework.web.servlet.resource.ResourceResolver;
import org.springframework.web.servlet.resource.ResourceTransformer; import org.springframework.web.servlet.resource.ResourceTransformer;
import org.springframework.web.servlet.resource.VersionResourceResolver; import org.springframework.web.servlet.resource.VersionResourceResolver;
import org.springframework.web.servlet.resource.WebJarsResourceResolver;
/** /**
* Assists with the registration of resource resolvers and transformers. * Assists with the registration of resource resolvers and transformers.
@ -92,8 +93,7 @@ public class ResourceChainRegistration {
else if (resolver instanceof PathResourceResolver) { else if (resolver instanceof PathResourceResolver) {
this.hasPathResolver = true; this.hasPathResolver = true;
} }
else if (resolver instanceof org.springframework.web.servlet.resource.WebJarsResourceResolver || else if (resolver instanceof WebJarsResourceResolver || resolver instanceof LiteWebJarsResourceResolver) {
resolver instanceof LiteWebJarsResourceResolver) {
this.hasWebjarsResolver = true; this.hasWebjarsResolver = true;
} }
return this; return this;
@ -121,7 +121,7 @@ public class ResourceChainRegistration {
result.add(new LiteWebJarsResourceResolver()); result.add(new LiteWebJarsResourceResolver());
} }
else if (isWebJarAssetLocatorPresent && !this.hasWebjarsResolver) { else if (isWebJarAssetLocatorPresent && !this.hasWebjarsResolver) {
result.add(new org.springframework.web.servlet.resource.WebJarsResourceResolver()); result.add(new WebJarsResourceResolver());
} }
result.add(new PathResourceResolver()); result.add(new PathResourceResolver());
return result; return result;

Loading…
Cancel
Save