Java 类org.springframework.boot.Banner 实例源码

项目:cas-5.1.0    文件:CasEmbeddedContainerUtils.java   
/**
 * 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();
}
项目:c2mon    文件:DaqStartup.java   
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");
}
项目:puppy-io    文件:PuppyAppLauncher.java   
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);
}
项目:authorization-server-with-mongodb    文件:ServerInfoService.java   
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;
        }

    }
项目:midpoint    文件:MidPointSpringApplication.java   
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);
}
项目:MLDS    文件:Application.java   
/**
 * 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);
}
项目:midpoint    文件:MidPointSpringApplication.java   
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);
}
项目:cas-5.1.0    文件:CasWebApplication.java   
/**
 * 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);
}
项目:loafer    文件:LoaferApplication.java   
public static void main(String[] args) {
    System.setProperty("spring.devtools.restart.enabled", "true");

    new SpringApplicationBuilder()
            .sources(LoaferApplication.class)
            .bannerMode(Banner.Mode.CONSOLE)
            .run(args);

}
项目:hekate    文件:HekateAutoConfigurerTestBase.java   
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);
}
项目:springBoot-project    文件:Application.java   
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);
}
项目:smarti    文件:MongoMigration.java   
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);
}
项目:lyre    文件:LyreRunner.java   
@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);
}
项目:mynlp    文件:Application.java   
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);
}
项目:sshd-shell-spring-boot    文件:ShellBanner.java   
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)));
    }
}
项目:restdoc-helper    文件:SpringbootSampleApplication.java   
/**
 * Main for app.
 *
 * @param args arguments
 */
public static void main(String[] args) {

    new SpringApplicationBuilder()
            .sources(SpringbootSampleApplication.class)
            .bannerMode(Banner.Mode.LOG)
            .run(args);
}
项目:werewolv.es-tools    文件:Main.java   
public static void main(String... args) throws Exception {
    SpringApplicationBuilder builder = new SpringApplicationBuilder()
            .bannerMode(Banner.Mode.OFF)
            .sources(SpringWebManager.class, BotConfiguration.class, BotServiceConfiguration.class)
            .main(SpringWebManager.class);

    SpringApplication application = builder.build();
    ConfigurableApplicationContext context = application.run(args);

    BotService service = context.getBean(BotService.class);
    Bot bot = context.getBean(Bot.class);

    BotManager manager = service.registerBot(bot);

    DispatchingMessageReceivedListener dispatchListener = new DispatchingMessageReceivedListener();

    GameService gameService = context.getBean(GameService.class);
    UserService userService = context.getBean(UserService.class);
    dispatchListener.registerCommandHandler(new ListActiveGamesHandler(gameService));
    dispatchListener.registerCommandHandler(new ListPendingGamesHandler(gameService));
    dispatchListener.registerCommandHandler(new ListArchivedGamesHandler(gameService));
    dispatchListener.registerCommandHandler(new StatsHandler(gameService));
    dispatchListener.registerCommandHandler(new UserStatsHandler(userService));

    // service.registerBotEventListener(manager, dispatchListener);
    bot.asEventSubscriber().registerBotEventListener(dispatchListener);

    IDiscordClient discordClient = context.getBean(IDiscordClient.class);
    manager.connect(new IrcServer("wwes-bot", URI.create("irc://irc.quakenet.org:6667")));
    manager.connect(new DiscordServer(discordClient));

}
项目:interview-preparation    文件:Application.java   
public static void main(String[] args) {
    // argument --debug gives you spring boot auto configuration report
    System.setProperty("spring.profiles.default", System.getProperty("spring.profiles.default", "dev"));
    // spring.output.ansi.enabled
    final SpringApplication app = new SpringApplication(Application.class);
    app.setBannerMode(Banner.Mode.OFF);
    app.run(args);
    // verifyKeystore();
}
项目:eiffel-remrem-publish    文件:App.java   
public static void main(String[] args) {
    SpringApplication application = new SpringApplication(App.class);
    application.addInitializers(new SpringLoggingInitializer());
    application.setBannerMode(Banner.Mode.OFF);
    application.setLogStartupInfo(false);
    application.setWebEnvironment(true);
    ApplicationContext ctx = application.run(args);
}
项目:eiffel-remrem-publish    文件:CLI.java   
public static void main(String args[]) {
    SpringApplication application = new SpringApplication(CLI.class);
    application.addInitializers(new SpringLoggingInitializer());
    application.setBannerMode(Banner.Mode.OFF);
    application.setLogStartupInfo(false);
    application.setWebEnvironment(false);
    CliOptions.parse(args);
    application.run(args);
}
项目:raptor    文件:BaseApplication.java   
public static SpringApplicationBuilder createInstance(Class clazz) {

        if (log == null) {
            log = LoggerFactory.getLogger(clazz);
        }

        return new SpringApplicationBuilder()
                .addCommandLineProperties(true)
                .bannerMode(Banner.Mode.OFF)
                .registerShutdownHook(true)
                .sources(clazz)
                .web(true);
    }
项目:vector-tiles-boot    文件:Application.java   
public static void main(String[] args)
{
    new SpringApplicationBuilder()
            .sources(Application.class)
            .bannerMode(Banner.Mode.OFF)
            .headless(true)
            .run(args);
}
项目:vert.3x-gateway    文件:Application.java   
public static void main(String[] args) {
    System.setProperty("spring.devtools.restart.enabled", "true");
    final ConfigurableApplicationContext context = new SpringApplicationBuilder(Application.class)
            .registerShutdownHook(true)
            .logStartupInfo(true)
            .bannerMode(Banner.Mode.CONSOLE)
            .run(args);

    final Vertx vertx = Vertx.vertx();
    vertx.deployVerticle(context.getBean(HttpServerVerticle.class), new DeploymentOptions().setWorker(true));
    vertx.deployVerticle(context.getBean(MicroServerVerticle.class));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigFileApplicationListenerTests.java   
@Test
public void bindsToSpringApplication() throws Exception {
    // gh-346
    this.initializer.setSearchNames("bindtoapplication");
    this.initializer.postProcessEnvironment(this.environment, this.application);
    Field field = ReflectionUtils.findField(SpringApplication.class, "bannerMode");
    field.setAccessible(true);
    assertThat((Banner.Mode) field.get(this.application)).isEqualTo(Banner.Mode.OFF);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigFileApplicationListenerTests.java   
@Test
public void bindsSystemPropertyToSpringApplication() throws Exception {
    // gh-951
    System.setProperty("spring.main.banner-mode", "off");
    this.initializer.postProcessEnvironment(this.environment, this.application);
    Field field = ReflectionUtils.findField(SpringApplication.class, "bannerMode");
    field.setAccessible(true);
    assertThat((Banner.Mode) field.get(this.application)).isEqualTo(Banner.Mode.OFF);
}
项目:eiffel-remrem-generate    文件:App.java   
private static void startService(String[] args) {
    SpringApplication application = new SpringApplication(App.class);
    application.setBannerMode(Banner.Mode.OFF);
    application.setLogStartupInfo(false);
    application.setWebEnvironment(true);
    ApplicationContext ctx = application.run(args);
}
项目:SimpleRedisCrud    文件:SimpleCrud.java   
/**
 * The main method.
 *
 * @param args
 *            the arguments
 */
public static void main(String[] args) {

    SpringApplication app = new SpringApplication(Application.class);
    app.setBannerMode(Banner.Mode.CONSOLE);
    app.setSources(Sets.newHashSet(ApplicationConfiguration.class, RedisApplicationConfiguration.class));
    app.setWebEnvironment(false);
    app.run(args);

}
项目:spring-boot-concourse    文件:ConfigFileApplicationListenerTests.java   
@Test
public void bindsToSpringApplication() throws Exception {
    // gh-346
    this.initializer.setSearchNames("bindtoapplication");
    this.initializer.postProcessEnvironment(this.environment, this.application);
    Field field = ReflectionUtils.findField(SpringApplication.class, "bannerMode");
    field.setAccessible(true);
    assertThat((Banner.Mode) field.get(this.application)).isEqualTo(Banner.Mode.OFF);
}
项目:spring-boot-concourse    文件:ConfigFileApplicationListenerTests.java   
@Test
public void bindsSystemPropertyToSpringApplication() throws Exception {
    // gh-951
    System.setProperty("spring.main.banner-mode", "off");
    this.initializer.postProcessEnvironment(this.environment, this.application);
    Field field = ReflectionUtils.findField(SpringApplication.class, "bannerMode");
    field.setAccessible(true);
    assertThat((Banner.Mode) field.get(this.application)).isEqualTo(Banner.Mode.OFF);
}
项目:Kafdrop    文件:KafDrop.java   
public static void main(String[] args)
{
   new SpringApplicationBuilder(KafDrop.class)
      .bannerMode(Banner.Mode.OFF)
      .listeners(new EnvironmentSetupListener(),
                 new LoggingConfigurationListener())
      .run(args);
}
项目:burstcoin-jminer    文件:JMinerApplication.java   
public static void main(String[] args)
{
  LOG.info("Starting the engines ... please wait!");

  // overwritten by application.properties
  Map<String, Object> properties = new HashMap<>();
  if(CoreProperties.isWriteLogFile())
  {
    properties.put("logging.file", CoreProperties.getLogFilePath());
  }
  properties.put("logging.level.burstcoin.jminer", CoreProperties.isDebug() ? "DEBUG" : "INFO");
  if(CoreProperties.getLogPatternConsole() != null)
  {
    properties.put("logging.pattern.console", CoreProperties.getLogPatternConsole());
  }
  if(CoreProperties.getLogPatternFile() != null)
  {
    properties.put("logging.pattern.file", CoreProperties.getLogPatternFile());
  }

  new SpringApplicationBuilder(JMinerApplication.class)
    .bannerMode(Banner.Mode.OFF) // turn off spring boot banner
    .logStartupInfo(false)
    .properties(properties) // add application.properties
    .build(args)
    .run();
}
项目:contestparser    文件:ConfigFileEnvironmentPostProcessorTests.java   
@Test
public void bindsToSpringApplication() throws Exception {
    // gh-346
    this.initializer.setSearchNames("bindtoapplication");
    this.initializer.postProcessEnvironment(this.environment, this.application);
    Field field = ReflectionUtils.findField(SpringApplication.class, "bannerMode");
    field.setAccessible(true);
    assertThat((Banner.Mode) field.get(this.application), equalTo(Banner.Mode.OFF));
}
项目:contestparser    文件:ConfigFileEnvironmentPostProcessorTests.java   
@Test
public void bindsSystemPropertyToSpringApplication() throws Exception {
    // gh-951
    System.setProperty("spring.main.banner-mode", "off");
    this.initializer.postProcessEnvironment(this.environment, this.application);
    Field field = ReflectionUtils.findField(SpringApplication.class, "bannerMode");
    field.setAccessible(true);
    assertThat((Banner.Mode) field.get(this.application), equalTo(Banner.Mode.OFF));
}
项目:javadoc-badge    文件:Launcher.java   
public static void main(String[] args) {
    LOG.info("Launcher started at {}", ZonedDateTime.now().format(ISO_OFFSET_DATE_TIME));
    new SpringApplicationBuilder()
            .sources(Launcher.class)
            .bannerMode(Banner.Mode.OFF)
            .build()
            .run(args);
}
项目:mesos-kibana    文件:KibanaFramework.java   
/**
 * Returns our cool custom banner
 *
 * @return our cool custom banner
 */
private static Banner getBanner() {
    return new Banner() {
        @Override
        public void printBanner(Environment environment, Class<?> sourceClass, PrintStream out) {
            out.print(  "  _  __ _  _                          \n" +
                        " | |/ /(_)| |__    __ _  _ __    __ _ \n" +
                        " | ' / | || '_ \\  / _` || '_ \\  / _` |\n" +
                        " | . \\ | || |_) || (_| || | | || (_| |\n" +
                        " |_|\\_\\|_||_.__/  \\__,_||_| |_| \\__,_|\n");
        }
    };
}
项目:herald    文件:SpringBootRunnerTest.java   
@Test
public void checkAppRunner() {
    final ApplicationContext context = new SpringApplicationBuilder()
        .headless(true)
        .logStartupInfo(false)
        .bannerMode(Banner.Mode.OFF)
        .sources(SpringBootTestContext.class)
        .run();

    assertThat(context, equalTo(context));
}
项目:uimaster    文件:SpringBootTestRoot.java   
@BeforeClass
public static void setup() {
    SpringApplication app = new SpringApplication(SpringBootTestRoot.class);
    app.setWebEnvironment(false);
    app.setBannerMode(Banner.Mode.OFF);
       app.run(new String[0]);
}
项目:uimaster    文件:SpringBootstrapperMojo.java   
public void execute() throws MojoExecutionException, MojoFailureException {
    contextObject.set(this);

    SpringApplication app = new SpringApplication(SpringBootstrapperMojo.class);
    app.setWebEnvironment(false);
    app.setBannerMode(Banner.Mode.CONSOLE);
    app.run(new String[0]);
}
项目:smtp-sender    文件:Application.java   
public static void main(String[] args) {
    log.info("application start");
    ConfigurableApplicationContext context = null;
    try {
        context = new SpringApplicationBuilder(Application.class)
                .registerShutdownHook(true)
                .headless(false)
                .bannerMode(Banner.Mode.OFF)
                .run(args);
        log.debug("load beans list - " + ArrayUtils.toString(context.getBeanDefinitionNames()));

        XTrustProvider.install();

        MainFrame mainFrame = ModuleService.getBean(MainFrame.class);
        mainFrame.execute();
        do {
            Thread.sleep(1000);
        } while (mainFrame.isVisible());
    } catch (Throwable e) {
        log.error("occurred application kill !", e);
    } finally {
        log.info("application exit");
        if (context != null) {
            context.close();
        }
    }
}
项目:singleTransferableVoteElections-web    文件:SpringConfig.java   
public static void main(String... args) {
   SpringApplication springApplication = new SpringApplication(SpringConfig.class);
   springApplication.setBannerMode(Banner.Mode.OFF);
   springApplication.setDefaultProperties(
    ImmutableMap.<String, Object>builder()
        .put("logging.level.", "WARN")
        .put("logging.level.ServerStarted", "INFO")
        .build());
   springApplication.addListeners(new ServerStartedMessagePrintingListener());
springApplication.run(args);
  }