当前位置: 首页>>代码示例>>Java>>正文


Java Banner类代码示例

本文整理汇总了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();
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:29,代码来源:CasEmbeddedContainerUtils.java

示例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);
}
 
开发者ID:mayabot,项目名称:mynlp,代码行数:12,代码来源:Application.java

示例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");
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:25,代码来源:DaqStartup.java

示例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);
}
 
开发者ID:quebic-source,项目名称:puppy-io,代码行数:26,代码来源:PuppyAppLauncher.java

示例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;
		}

	}
 
开发者ID:cloudade,项目名称:authorization-server-with-mongodb,代码行数:25,代码来源:ServerInfoService.java

示例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);
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:20,代码来源:MidPointSpringApplication.java

示例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);
}
 
开发者ID:IHTSDO,项目名称:MLDS,代码行数:22,代码来源:Application.java

示例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);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:17,代码来源:CasWebApplication.java

示例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);

}
 
开发者ID:yuexine,项目名称:loafer,代码行数:10,代码来源:LoaferApplication.java

示例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);
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:15,代码来源:HekateAutoConfigurerTestBase.java

示例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);
}
 
开发者ID:longjiazuo,项目名称:springBoot-project,代码行数:16,代码来源:Application.java

示例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);
}
 
开发者ID:redlink-gmbh,项目名称:smarti,代码行数:15,代码来源:MongoMigration.java

示例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);
}
 
开发者ID:groovylabs,项目名称:lyre,代码行数:10,代码来源:LyreRunner.java

示例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)));
    }
}
 
开发者ID:anand1st,项目名称:sshd-shell-spring-boot,代码行数:8,代码来源:ShellBanner.java

示例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);
}
 
开发者ID:patrice-conil,项目名称:restdoc-helper,代码行数:13,代码来源:SpringbootSampleApplication.java


注:本文中的org.springframework.boot.Banner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。