本文整理汇总了Java中org.springframework.boot.Banner.Mode类的典型用法代码示例。如果您正苦于以下问题:Java Mode类的具体用法?Java Mode怎么用?Java Mode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Mode类属于org.springframework.boot.Banner包,在下文中一共展示了Mode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
// below is output *before* logging is configured so will appear on console
logVersionInfo();
try {
SpringApplication.exit(new SpringApplicationBuilder(VacuumTool.class)
.properties("spring.config.location:${config:null}")
.properties("spring.profiles.active:" + Modules.REPLICATION)
.properties("instance.home:${user.home}")
.properties("instance.name:${source-catalog.name}_${replica-catalog.name}")
.bannerMode(Mode.OFF)
.registerShutdownHook(true)
.build()
.run(args));
} catch (BeanCreationException e) {
if (e.getMostSpecificCause() instanceof BindException) {
printVacuumToolHelp(((BindException) e.getMostSpecificCause()).getAllErrors());
}
throw e;
}
}
示例2: main
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
// below is output *before* logging is configured so will appear on console
logVersionInfo();
try {
SpringApplication.exit(new SpringApplicationBuilder(ComparisonTool.class)
.properties("spring.config.location:${config:null}")
.properties("spring.profiles.active:" + Modules.REPLICATION)
.properties("instance.home:${user.home}")
.properties("instance.name:${source-catalog.name}_${replica-catalog.name}")
.bannerMode(Mode.OFF)
.registerShutdownHook(true)
.build()
.run(args));
} catch (BeanCreationException e) {
if (e.getMostSpecificCause() instanceof BindException) {
printComparisonToolHelp(((BindException) e.getMostSpecificCause()).getAllErrors());
throw e;
}
if (e.getMostSpecificCause() instanceof IllegalArgumentException) {
LOG.error(e.getMessage(), e);
printComparisonToolHelp(Collections.<ObjectError> emptyList());
}
}
}
示例3: main
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
// below is output *before* logging is configured so will appear on console
logVersionInfo();
try {
SpringApplication.exit(new SpringApplicationBuilder(FilterTool.class)
.properties("spring.config.location:${config:null}")
.properties("spring.profiles.active:" + Modules.REPLICATION)
.properties("instance.home:${user.home}")
.properties("instance.name:${source-catalog.name}_${replica-catalog.name}")
.bannerMode(Mode.OFF)
.registerShutdownHook(true)
.build()
.run(args));
} catch (BeanCreationException e) {
if (e.getMostSpecificCause() instanceof BindException) {
printFilterToolHelp(((BindException) e.getMostSpecificCause()).getAllErrors());
}
throw e;
}
}
示例4: main
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
public static void main(final String[] args) {
System.setProperty("vertx.disableDnsResolver", "true");
System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory");
final File logbackFile = new File("logback.xml");
if (logbackFile.exists()) {
System.setProperty("logging.config", logbackFile.getAbsolutePath());
}
final SpringApplication application = new SpringApplication(GatewayMS.class);
application.setBannerMode(Mode.OFF);
application.setWebEnvironment(false);
application.run(args);
}
示例5: main
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
try (ConfigurableApplicationContext ctx = new SpringApplicationBuilder(SpringBootstrap.class)
.bannerMode(Mode.OFF).web(false).run(args)) {
Configuration conf = ctx.getBean(Configuration.class);
final BaseConfiguration apacheConf = new BaseConfiguration();
Configuration.Accumulo accumuloConf = conf.getAccumulo();
apacheConf.setProperty("instance.name", accumuloConf.getInstanceName());
apacheConf.setProperty("instance.zookeeper.host", accumuloConf.getZookeepers());
final ClientConfiguration aconf = new ClientConfiguration(Collections.singletonList(apacheConf));
final Instance instance = new ZooKeeperInstance(aconf);
Connector con = instance.getConnector(accumuloConf.getUsername(),
new PasswordToken(accumuloConf.getPassword()));
Scanner s = con.createScanner(conf.getMetaTable(),
con.securityOperations().getUserAuthorizations(con.whoami()));
try {
s.setRange(new Range(Meta.METRIC_PREFIX, true, Meta.TAG_PREFIX, false));
for (Entry<Key, Value> e : s) {
System.out.println(e.getKey().getRow().toString().substring(Meta.METRIC_PREFIX.length()));
}
} finally {
s.close();
}
}
}
示例6: printBanner
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
private Banner printBanner(ConfigurableEnvironment environment) {
if (this.bannerMode == Banner.Mode.OFF) {
return null;
}
if (printBannerViaDeprecatedMethod(environment)) {
return null;
}
ResourceLoader resourceLoader = this.resourceLoader != null ? this.resourceLoader
: new DefaultResourceLoader(getClassLoader());
SpringApplicationBannerPrinter bannerPrinter = new SpringApplicationBannerPrinter(
resourceLoader, this.banner);
if (this.bannerMode == Mode.LOG) {
return bannerPrinter.print(environment, this.mainApplicationClass, logger);
}
return bannerPrinter.print(environment, this.mainApplicationClass, System.out);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:SpringApplication.java
示例7: main
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
public static void main(String[] cmdLineArgs) throws Exception {
// String[] args = new String[cmdLineArgs.length + 1];
// args[0] = "--debug";
// System.arraycopy(cmdLineArgs, 0, args, 1, cmdLineArgs.length);
SpringApplicationBuilder builder = new SpringApplicationBuilder(StartBackend.class);
builder//
.bannerMode(Mode.LOG)//
// .sources(Start.class)//
// .child(Main.class)//
.logStartupInfo(true)//
.registerShutdownHook(true)//
.run(cmdLineArgs);
// ConfigurableApplicationContext springContext = SpringApplication.run(Start.class, args);
// springContext.registerShutdownHook();
// ClassPathXmlApplicationContext ctx = new
// ClassPathXmlApplicationContext("classpath*:spring/*.xml");
//
// // synchronized (Thread.currentThread()) {
// // Thread.currentThread().wait();
// // }
// System.in.read();
// ctx.close();
}
示例8: main
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
public static void main(String[] cmdLineArgs) throws Exception {
if (cmdLineArgs.length < 2) {
System.exit(1);
}
SpringApplicationBuilder builder = new SpringApplicationBuilder(Main.class);
builder//
.bannerMode(Mode.LOG)//
// .sources(Main.class)//
// .child(Main.class)//
.registerShutdownHook(true)//
.run();
ConfigurableApplicationContext springContext = builder.context();
Parser parser = springContext.getBean(Parser.class);
Response rspObj = parser.parse(cmdLineArgs[0], cmdLineArgs[1]);
ObjectMapper om = new ObjectMapper();
String resp = om.writeValueAsString(rspObj);
System.out.print(resp);
System.exit(0);
}
示例9: retryableRestOperationsFailAndRetrySuccessTest
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
@Test
public void retryableRestOperationsFailAndRetrySuccessTest() throws InterruptedException {
ctx.close();
RestOperations restOperations = RestTemplateFactory.createCommonsHttpRestTemplate(10, 100, 5000, 5000, 30,
RetryPolicyFactories.newRestOperationsRetryPolicyFactory(100));
Thread appStartThread = new Thread(new Runnable() {
@Override
public void run() {
logger.info(remarkableMessage("New SpringApplication"));
SpringApplication app2 = new SpringApplication(SimpleTestSpringServer.class);
app2.setBannerMode(Mode.OFF);
ctx = app2.run("");
ctx.start();
}
});
appStartThread.start();
String response = restOperations.getForObject(generateRequestURL("/test"), String.class);
assertEquals(targetResponse, response);
appStartThread.join();
}
示例10: main
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
/**
* @param args The command line arguments.
*/
@SuppressFBWarnings(value="DM_DEFAULT_ENCODING", justification="DEV-NULL encoding is irrelevant")
public static void main(String[] args) {
try (PrintStream devNull = new PrintStream(ByteStreams.nullOutputStream()))
{
System.setErr(devNull);
ctx = new SpringApplicationBuilder(
ScheduleConfiguration.class,
RunNowConfiguration.class,
SmokeTestConfiguration.class,
RunConfigConfiguration.class)
.bannerMode(Mode.OFF)
.listeners(new ApplicationPidFileWriter())
.web(false)
.run(args);
ctx.start();
} catch (Throwable t) {
errHandler.handle(t);
}
}
示例11: keysComputedWhenChangesInExternalProperties
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
@Test
public void keysComputedWhenChangesInExternalProperties() throws Exception {
this.context = new SpringApplicationBuilder(Empty.class)
.web(WebApplicationType.NONE).bannerMode(Mode.OFF)
.properties("spring.cloud.bootstrap.name:none").run();
RefreshScope scope = new RefreshScope();
scope.setApplicationContext(this.context);
TestPropertyValues
.of("spring.cloud.bootstrap.sources="
+ ExternalPropertySourceLocator.class.getName())
.applyTo(this.context.getEnvironment(), Type.MAP, "defaultProperties");
ContextRefresher contextRefresher = new ContextRefresher(this.context, scope);
RefreshEndpoint endpoint = new RefreshEndpoint(contextRefresher);
Collection<String> keys = endpoint.refresh();
assertTrue("Wrong keys: " + keys, keys.contains("external.message"));
}
示例12: springMainSourcesEmptyInRefreshCycle
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
@Test
public void springMainSourcesEmptyInRefreshCycle() throws Exception {
this.context = new SpringApplicationBuilder(Empty.class)
.web(WebApplicationType.NONE).bannerMode(Mode.OFF)
.properties("spring.cloud.bootstrap.name:none").run();
RefreshScope scope = new RefreshScope();
scope.setApplicationContext(this.context);
// spring.main.sources should be empty when the refresh cycle starts (we don't
// want any config files from the application context getting into the one used to
// construct the environment for refresh)
TestPropertyValues
.of("spring.main.sources="
+ ExternalPropertySourceLocator.class.getName())
.applyTo(this.context);
ContextRefresher contextRefresher = new ContextRefresher(this.context, scope);
RefreshEndpoint endpoint = new RefreshEndpoint(contextRefresher);
Collection<String> keys = endpoint.refresh();
assertFalse("Wrong keys: " + keys, keys.contains("external.message"));
}
示例13: loadCloudProperties
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
private DeployerProperties loadCloudProperties() {
final ConfigurableApplicationContext context = new SpringApplicationBuilder(
PropertyPlaceholderAutoConfiguration.class, DeployerConfiguration.class)
.bannerMode(Mode.OFF).logStartupInfo(false).web(false)
.properties("spring.config.name=cloud", "logging.level.ROOT=OFF",
"spring.cloud.launcher.list=true",
"launcher.version=" + getVersion())
.run(this.args);
try {
return context.getBean(DeployerProperties.class);
}
finally {
context.close();
}
}
示例14: findOne
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
@Override
public Environment findOne(String config, String profile, String label) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(
PropertyPlaceholderAutoConfiguration.class);
ConfigurableEnvironment environment = getEnvironment(profile);
builder.environment(environment);
builder.web(WebApplicationType.NONE).bannerMode(Mode.OFF);
if (!logger.isDebugEnabled()) {
// Make the mini-application startup less verbose
builder.logStartupInfo(false);
}
String[] args = getArgs(config, profile, label);
// Explicitly set the listeners (to exclude logging listener which would change
// log levels in the caller)
builder.application()
.setListeners(Arrays.asList(new ConfigFileApplicationListener()));
ConfigurableApplicationContext context = builder.run(args);
environment.getPropertySources().remove("profiles");
try {
return clean(new PassthruEnvironmentRepository(environment).findOne(config,
profile, label));
}
finally {
context.close();
}
}
示例15: main
import org.springframework.boot.Banner.Mode; //导入依赖的package包/类
public static void main(String[] args) {
new SpringApplicationBuilder()
.listeners(new EnvironmentPrepareListener())
.sources(Application.class)
.bannerMode(Mode.CONSOLE)
.build()
.run(args);
}