类org.springframework.boot.autoconfigure.session.SessionAutoConfiguration源码实例Demo

下面列出了怎么用org.springframework.boot.autoconfigure.session.SessionAutoConfiguration的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * 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.spring[email protected]377f9cb6 has been closed already
		//
		return true;
	}
	finally {
		executorService.shutdownNow();
	}

}
 
 类方法
 同包方法