當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。