[SPR-8387] Fixed logic errors in DelegatingSmartContextLoader.processContextConfiguration() and ContextConfigurationAttributes.hasResources().
This commit is contained in:
parent
e34fa6abb1
commit
e7298a88d6
|
@ -168,13 +168,13 @@ public class ContextConfigurationAttributes {
|
||||||
/**
|
/**
|
||||||
* Determine if this {@code ContextConfigurationAttributes} instance has
|
* Determine if this {@code ContextConfigurationAttributes} instance has
|
||||||
* either path-based resource locations or class-based resources.
|
* either path-based resource locations or class-based resources.
|
||||||
* @return <code>true</code> if neither the {@link #getLocations() locations}
|
* @return <code>true</code> if either the {@link #getLocations() locations}
|
||||||
* nor the {@link #getClasses() classes} array is empty
|
* or the {@link #getClasses() classes} array is not empty
|
||||||
* @see #getLocations()
|
* @see #getLocations()
|
||||||
* @see #getClasses()
|
* @see #getClasses()
|
||||||
*/
|
*/
|
||||||
public boolean hasResources() {
|
public boolean hasResources() {
|
||||||
return !ObjectUtils.isEmpty(getLocations()) && !ObjectUtils.isEmpty(getClasses());
|
return !ObjectUtils.isEmpty(getLocations()) || !ObjectUtils.isEmpty(getClasses());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class DelegatingSmartContextLoader implements SmartContextLoader {
|
||||||
|
|
||||||
// If any loader claims to generate defaults but none actually did,
|
// If any loader claims to generate defaults but none actually did,
|
||||||
// throw an exception.
|
// throw an exception.
|
||||||
if (originallyHadResources && generatesDefaults() && !configAttributes.hasResources()) {
|
if (generatesDefaults() && !originallyHadResources && !configAttributes.hasResources()) {
|
||||||
throw new IllegalStateException(String.format("None of the SmartContextLoader candidates %s "
|
throw new IllegalStateException(String.format("None of the SmartContextLoader candidates %s "
|
||||||
+ "was able to generate defaults for context configuration [%s].", candidates, configAttributes));
|
+ "was able to generate defaults for context configuration [%s].", candidates, configAttributes));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue