Refine SpringApplication source types
Update `SpringApplication` so that the `run` methods and constructors now require `Class<?>` arguments, rather than `Objects`. String based sources can still be loaded, but must now be set on the `getSources()` collections. `Package` and `Resource` types are no longer directly supported. This change should help IDEs offer better content assist, and will help integrations with alternative languages such as Ceylon. Users currently passing in Class references or using the `spring.main.sources` property should not be affected by this change. If an XML resource is being used, some refactoring may be required (see the changes to `SampleSpringXmlApplication` in this commit). Fixes gh-9170
This commit is contained in:
@@ -73,7 +73,7 @@ public class SpringApplicationLauncherTests {
|
||||
public void sourcesDefaultPropertiesAndArgsAreUsedToLaunch() throws Exception {
|
||||
System.setProperty("spring.application.class.name",
|
||||
TestSpringApplication.class.getName());
|
||||
Object[] sources = new Object[0];
|
||||
Class<?>[] sources = new Class<?>[0];
|
||||
String[] args = new String[0];
|
||||
new SpringApplicationLauncher(getClass().getClassLoader()).launch(sources, args);
|
||||
|
||||
@@ -88,7 +88,7 @@ public class SpringApplicationLauncherTests {
|
||||
private Set<String> launch() {
|
||||
TestClassLoader classLoader = new TestClassLoader(getClass().getClassLoader());
|
||||
try {
|
||||
new TestSpringApplicationLauncher(classLoader).launch(new Object[0],
|
||||
new TestSpringApplicationLauncher(classLoader).launch(new Class<?>[0],
|
||||
new String[0]);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
@@ -129,7 +129,7 @@ public class SpringApplicationLauncherTests {
|
||||
|
||||
private static String[] args;
|
||||
|
||||
public TestSpringApplication(Object[] sources) {
|
||||
public TestSpringApplication(Class<?>[] sources) {
|
||||
TestSpringApplication.sources = sources;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user