Allocate objects only when it's necessary
Closes gh-23036
This commit is contained in:
committed by
Sam Brannen
parent
6f2f5bb8c1
commit
6964ed33bf
@@ -245,9 +245,9 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||
for (String suffix : suffixes) {
|
||||
Assert.hasText(suffix, "Resource suffix must not be empty");
|
||||
String resourcePath = ClassUtils.convertClassNameToResourcePath(clazz.getName()) + suffix;
|
||||
String prefixedResourcePath = ResourceUtils.CLASSPATH_URL_PREFIX + resourcePath;
|
||||
ClassPathResource classPathResource = new ClassPathResource(resourcePath);
|
||||
if (classPathResource.exists()) {
|
||||
String prefixedResourcePath = ResourceUtils.CLASSPATH_URL_PREFIX + resourcePath;
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info(String.format("Detected default resource location \"%s\" for test class [%s]",
|
||||
prefixedResourcePath, clazz.getName()));
|
||||
|
||||
@@ -156,10 +156,10 @@ class TestPropertySourceAttributes {
|
||||
*/
|
||||
private static String detectDefaultPropertiesFile(Class<?> testClass) {
|
||||
String resourcePath = ClassUtils.convertClassNameToResourcePath(testClass.getName()) + ".properties";
|
||||
String prefixedResourcePath = ResourceUtils.CLASSPATH_URL_PREFIX + resourcePath;
|
||||
ClassPathResource classPathResource = new ClassPathResource(resourcePath);
|
||||
|
||||
if (classPathResource.exists()) {
|
||||
String prefixedResourcePath = ResourceUtils.CLASSPATH_URL_PREFIX + resourcePath;
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info(String.format("Detected default properties file \"%s\" for test class [%s]",
|
||||
prefixedResourcePath, testClass.getName()));
|
||||
|
||||
Reference in New Issue
Block a user