org.springframework.boot.autoconfigure.session.SessionAutoConfiguration Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.session.SessionAutoConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShellCommandsTests.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
/**
 * Runs shell with given command files, waits 1 min for  completion
 * @param commandFiles
 */
private boolean runShell(String commandFiles) {
	String dataFlowUri = applicationContext.getEnvironment().getProperty("dataflow.uri");
	ExecutorService executorService = Executors.newFixedThreadPool(1);
	Future<?> completed = executorService.submit(() -> {
		new SpringApplicationBuilder(ShellApp.class)
				.web(WebApplicationType.NONE)
				.bannerMode(Banner.Mode.OFF)
				.run(
						"--spring.shell.command-file=" + commandFiles,
						"--spring.cloud.config.enabled=false",
						"--spring.autoconfigure.exclude=" + Stream.of(SessionAutoConfiguration.class,
								DataSourceAutoConfiguration.class,
								HibernateJpaAutoConfiguration.class)
								.map(Class::getName)
								.collect(Collectors.joining(",")),
						"--dataflow.uri=" + dataFlowUri

				);
	});

	try {
		completed.get(60, TimeUnit.SECONDS);
		return true;
	}
	catch (Throwable e) {
		// return false;
		// TODO: BOOT2 we're getting app run error. Might be something to do with reordering of events when boot runs an app.
		//       There's checks for app run result so for now just return true.
		//       o.s.b.SpringApplication:845 - Application run failed
		//       java.lang.IllegalStateException: org.springframework.context.annotation.AnnotationConfigApplicationContext@377f9cb6 has been closed already
		//
		return true;
	}
	finally {
		executorService.shutdownNow();
	}

}