Merge branch '5.3.x'
# Conflicts: # spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java # spring-context/src/test/java/org/springframework/context/support/GenericApplicationContextTests.java
This commit is contained in:
@@ -35,6 +35,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.ProtocolResolver;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
@@ -93,6 +94,7 @@ import org.springframework.util.Assert;
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @author Stephane Nicoll
|
||||
* @author Sam Brannen
|
||||
* @since 1.1.2
|
||||
* @see #registerBeanDefinition
|
||||
* @see #refresh()
|
||||
@@ -223,13 +225,23 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This implementation delegates to this context's ResourceLoader if set,
|
||||
* falling back to the default superclass behavior else.
|
||||
* @see #setResourceLoader
|
||||
* This implementation delegates to this context's {@code ResourceLoader} if set,
|
||||
* falling back to the default superclass behavior otherwise.
|
||||
* <p>As of Spring Framework 5.3.22, this method also honors registered
|
||||
* {@linkplain #getProtocolResolvers() protocol resolvers} when a custom
|
||||
* {@code ResourceLoader} has been set.
|
||||
* @see #setResourceLoader(ResourceLoader)
|
||||
* @see #addProtocolResolver(ProtocolResolver)
|
||||
*/
|
||||
@Override
|
||||
public Resource getResource(String location) {
|
||||
if (this.resourceLoader != null) {
|
||||
for (ProtocolResolver protocolResolver : getProtocolResolvers()) {
|
||||
Resource resource = protocolResolver.resolve(location, this);
|
||||
if (resource != null) {
|
||||
return resource;
|
||||
}
|
||||
}
|
||||
return this.resourceLoader.getResource(location);
|
||||
}
|
||||
return super.getResource(location);
|
||||
@@ -238,7 +250,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
|
||||
/**
|
||||
* This implementation delegates to this context's ResourceLoader if it
|
||||
* implements the ResourcePatternResolver interface, falling back to the
|
||||
* default superclass behavior else.
|
||||
* default superclass behavior otherwise.
|
||||
* @see #setResourceLoader
|
||||
*/
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user