本文整理汇总了Java中org.springframework.boot.Banner类的典型用法代码示例。如果您正苦于以下问题:Java Banner类的具体用法?Java Banner怎么用?Java Banner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Banner类属于org.springframework.boot包,在下文中一共展示了Banner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCasBannerInstance
import org.springframework.boot.Banner; //导入依赖的package包/类
/**
* Gets cas banner instance.
*
* @return the cas banner instance
*/
public static Banner getCasBannerInstance() {
final String packageName = CasEmbeddedContainerUtils.class.getPackage().getName();
final Reflections reflections =
new Reflections(new ConfigurationBuilder()
.filterInputsBy(new FilterBuilder().includePackage(packageName))
.setUrls(ClasspathHelper.forPackage(packageName))
.setScanners(new SubTypesScanner(true)));
final Set<Class<? extends AbstractCasBanner>> subTypes = reflections.getSubTypesOf(AbstractCasBanner.class);
subTypes.remove(DefaultCasBanner.class);
if (subTypes.isEmpty()) {
return new DefaultCasBanner();
}
try {
final Class<? extends AbstractCasBanner> clz = subTypes.iterator().next();
LOGGER.debug("Created banner [{}]", clz);
return clz.newInstance();
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
return new DefaultCasBanner();
}
示例2: main
import org.springframework.boot.Banner; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.setBannerMode(Banner.Mode.OFF);
app.setLogStartupInfo(false);
app.setRegisterShutdownHook(false);
Map<String, Object> pro = Maps.newHashMap();
pro.put("logging.level.root", "ERROR");
app.setDefaultProperties(pro);
app.run(args);
}
示例3: start
import org.springframework.boot.Banner; //导入依赖的package包/类
public static synchronized void start(String[] args) throws IOException {
String daqName = getProperty("c2mon.daq.name");
if (daqName == null) {
throw new RuntimeException("Please specify the DAQ process name using 'c2mon.daq.name'");
}
// The JMS mode (single, double, test) is controlled via Spring profiles
String mode = getProperty("c2mon.daq.jms.mode");
if (mode != null) {
System.setProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, mode);
}
if (application == null) {
application = new SpringApplicationBuilder(DaqStartup.class)
.bannerMode(Banner.Mode.OFF)
.build();
}
context = application.run(args);
driverKernel = context.getBean(DriverKernel.class);
driverKernel.init();
log.info("DAQ core is now initialized");
}
示例4: startSpringBoot
import org.springframework.boot.Banner; //导入依赖的package包/类
private void startSpringBoot(String... args){
Object[] objects = new Object[2];
objects[0] = PuppyAppLauncher.class;
objects[1] = appClass;
SpringApplication app = new SpringApplication(objects);
app.setBanner(new Banner() {
@Override
public void printBanner(Environment arg0, Class<?> arg1, PrintStream printStream) {
StringBuilder stringBuilderDec = new StringBuilder("###########");
for(int i = 0; i < appName.length(); i++){
stringBuilderDec.append("#");
}
printStream.println(stringBuilderDec.toString());
printStream.println("puppy-io [" + appName +"]");
printStream.println(stringBuilderDec.toString());
}
});
//app.setBannerMode(Banner.Mode.OFF);
context = app.run(args);
}
示例5: saveServerInfo
import org.springframework.boot.Banner; //导入依赖的package包/类
public ServerInfo saveServerInfo(ServerInfo serverInfo) throws IOException{
String jvmName = ManagementFactory.getRuntimeMXBean().getName();
String host = getHostname();
String springBootVersion = Banner.class.getPackage().getImplementationVersion();
String appVersion = getClass().getPackage().getImplementationVersion();
if (serverInfo != null) {
serverInfo.setSpringBootVersion(springBootVersion);
serverInfo.setAppVersion(appVersion);
serverInfo.setPid(jvmName.split("@")[0]);
serverInfo.setLastStartedAt( new LocalDate() );
serverInfoRepository.save(serverInfo);
return serverInfo;
} else {
serverInfo = new ServerInfo(null, host, port + "",
jvmName.split("@")[0], appName, springBootVersion, appVersion, new LocalDate(), new LocalDate());
serverInfoRepository.save(serverInfo);
return serverInfo;
}
}
示例6: configureApplication
import org.springframework.boot.Banner; //导入依赖的package包/类
private static SpringApplicationBuilder configureApplication(SpringApplicationBuilder application) {
String mpHome = System.getProperty(MIDPOINT_HOME_PROPERTY);
if (StringUtils.isEmpty(mpHome)) {
LOGGER.info("{} system property is not set, using default configuration", MIDPOINT_HOME_PROPERTY);
mpHome = System.getProperty(USER_HOME_PROPERTY_NAME);
if (!mpHome.endsWith("/")) {
mpHome += "/";
}
mpHome += "midpoint";
System.setProperty(MIDPOINT_HOME_PROPERTY, mpHome);
}
System.setProperty("spring.config.location", "${midpoint.home}/");
application.bannerMode(Banner.Mode.LOG);
return application.sources(MidPointSpringApplication.class);
}
示例7: main
import org.springframework.boot.Banner; //导入依赖的package包/类
/**
* Main method, used to run the application.
*
* To run the application with hot reload enabled, add the following arguments to your JVM:
* "-javaagent:spring_loaded/springloaded-jhipster.jar -noverify -Dspringloaded=plugins=io.github.jhipster.loaded.instrument.JHipsterLoadtimeInstrumentationPlugin"
*/
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.setBannerMode(Banner.Mode.OFF);
SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
// Check if the selected profile has been set as argument.
// if not the development profile will be added
addDefaultProfile(app, source);
// Fallback to set the list of liquibase package list
addLiquibaseScanPackages();
app.run(args);
}
示例8: main
import org.springframework.boot.Banner; //导入依赖的package包/类
/**
* Main entry point of the CAS web application.
*
* @param args the args
*/
public static void main(final String[] args) {
final Map<String, Object> properties = CasEmbeddedContainerUtils.getRuntimeProperties(Boolean.TRUE);
final Banner banner = CasEmbeddedContainerUtils.getCasBannerInstance();
new SpringApplicationBuilder(CasWebApplication.class)
.banner(banner)
.web(true)
.properties(properties)
.logStartupInfo(true)
.contextClass(CasWebApplicationContext.class)
.run(args);
}
示例9: main
import org.springframework.boot.Banner; //导入依赖的package包/类
public static void main(String[] args) {
System.setProperty("spring.devtools.restart.enabled", "true");
new SpringApplicationBuilder()
.sources(LoaferApplication.class)
.bannerMode(Banner.Mode.CONSOLE)
.run(args);
}
示例10: registerAndRefresh
import org.springframework.boot.Banner; //导入依赖的package包/类
protected void registerAndRefresh(String[] args, Class<?>... annotatedClasses) {
String[] nullSafeArgs = args == null ? EMPTY_ARGS : Stream.of(args).map(arg -> "--" + arg).toArray(String[]::new);
assertTrue("Context parameters must use '=' to separate name and value: " + Arrays.toString(args),
Stream.of(nullSafeArgs).allMatch(arg -> arg.indexOf('=') > 0)
);
SpringApplication app = new SpringApplication((Object[])annotatedClasses);
app.setBannerMode(Banner.Mode.OFF);
ctx = app.run(nullSafeArgs);
allCtx.add(ctx);
}
示例11: main
import org.springframework.boot.Banner; //导入依赖的package包/类
public static void main(String[] args) {
// SpringApplication.run(HelloApplication.class, args);
/**
* 关闭Banner方法一
*/
// SpringApplication application = new
// SpringApplication(HelloApplication.class);
// application.setBannerMode(Banner.Mode.OFF);
// application.run(args);
/**
* 关闭Banner方法二
*/
new SpringApplicationBuilder(Application.class).bannerMode(Banner.Mode.OFF).run(args);
}
示例12: main
import org.springframework.boot.Banner; //导入依赖的package包/类
public static void main(String... args) {
final SpringApplication app = new SpringApplication(MongoMigration.class);
app.setBannerMode(Banner.Mode.OFF);
boolean hasError = false;
try (ConfigurableApplicationContext context = app.run(args)) {
context.getBean(MongoDbMigrationService.class).runDatabaseMigration();
} catch (IOException e) {
hasError = true;
log.error("Error while running database-migration: {}", e.getMessage(), e);
}
if (hasError) System.exit(1);
}
示例13: run
import org.springframework.boot.Banner; //导入依赖的package包/类
@Override
public void run(ApplicationArguments args) throws Exception {
SpringApplication app = new SpringApplication(Lyre.class);
String[] arguments = RunnerUtils.buildArguments(app.getMainApplicationClass().getAnnotation(EnableLyre.class));
app.setMainApplicationClass(Lyre.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(arguments);
}
示例14: addBanner
import org.springframework.boot.Banner; //导入依赖的package包/类
private void addBanner(ResourceLoader resourceLoader, String bannerResourceName,
Function<Resource, Banner> function) {
Resource bannerResource = resourceLoader.getResource(bannerResourceName);
if (bannerResource.exists()) {
banners.add(new BannerDecorator(function.apply(bannerResource)));
}
}
示例15: main
import org.springframework.boot.Banner; //导入依赖的package包/类
/**
* Main for app.
*
* @param args arguments
*/
public static void main(String[] args) {
new SpringApplicationBuilder()
.sources(SpringbootSampleApplication.class)
.bannerMode(Banner.Mode.LOG)
.run(args);
}