/** * Create a new {@link SpringApplication} instance. The application context will load * beans from the specified primary sources (see {@link SpringApplication class-level} * documentation for details. The instance can be customized before calling * {@link #run(String...)}. * @param resourceLoader the resource loader to use * @param primarySources the primary bean sources * @see #run(Class, String[]) * @see #setSources(Set) */ @SuppressWarnings({ "unchecked", "rawtypes" }) public SpringApplication(ResourceLoader resourceLoader, Class<?>... primarySources) { this.resourceLoader = resourceLoader; Assert.notNull(primarySources, "PrimarySources must not be null"); this.primarySources = new LinkedHashSet<>(Arrays.asList(primarySources)); this.webApplicationType = WebApplicationType.deduceFromClasspath(); setInitializers((Collection) getSpringFactoriesInstances( ApplicationContextInitializer.class)); setListeners((Collection) getSpringFactoriesInstances(ApplicationListener.class)); this.mainApplicationClass = deduceMainApplicationClass(); }
private void run(String[] args) { Restarter.initialize(args, RestartInitializer.NONE); SpringApplication application = new SpringApplication( RemoteClientConfiguration.class); application.setWebApplicationType(WebApplicationType.NONE); application.setBanner(getBanner()); application.setInitializers(getInitializers()); application.setListeners(getListeners()); application.run(args); waitIndefinitely(); }
application.setWebApplicationType(WebApplicationType.NONE); application.setInitializers(initializers); return application.run();