Disable default configuration detection in @SpringApplicationConfiguration

This is a holding pattern until SPR-11455 is fixed. We now throw an
exception with a helpful message instead of ttrying to detect default
configuration.

Fixes gh-380
This commit is contained in:
Dave Syer
2014-02-25 12:51:36 +00:00
parent f0f73a4ead
commit cfba5e8361
2 changed files with 5 additions and 3 deletions

View File

@@ -91,9 +91,9 @@ public class SpringApplicationContextLoader extends AbstractContextLoader {
sources.addAll(Arrays.asList(mergedConfig.getClasses()));
sources.addAll(Arrays.asList(mergedConfig.getLocations()));
if (sources.isEmpty()) {
Class<?>[] defaultConfigClasses = detectDefaultConfigurationClasses(mergedConfig
.getTestClass());
sources.addAll(Arrays.asList(defaultConfigClasses));
throw new IllegalStateException(
"No configuration resources found (use classes= or locations= in @SpringApplicationConfiguration). "
+ "Default configuration detection is not supported with this loader (see SPR-11455 for details)");
}
return sources;
}

View File

@@ -16,6 +16,7 @@
package org.springframework.boot.test;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +33,7 @@ import static org.junit.Assert.assertNotNull;
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration
@Ignore("Ignore until gh-380, SPR-11455 can be resolved")
public class SpringApplicationConfigurationDefaultConfigurationTests {
@Autowired