Exemple #1
0
  private void run(String[] args) {
    //        checkSystemProperties(zkUrl);

    SpringApplication app = new SpringApplication(Application.class);
    app.setShowBanner(false);
    app.run(args);
  }
  /** Main method, used to run the application. */
  public static void main(String[] args) {
    SpringApplication app = new SpringApplication(Application.class);
    app.setShowBanner(false);

    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);
    app.run(args);
  }
Exemple #3
0
  public static void main(String[] args) throws UnknownHostException {
    SpringApplication app = new SpringApplication(Application.class);
    app.setShowBanner(false);

    Environment env = app.run(args).getEnvironment();
    log.info(
        "Access URLs:\n----------------------------------------------------------\n\t"
            + "Local: \t\thttp://127.0.0.1:{}\n\t"
            + "External: \thttp://{}:{}\n----------------------------------------------------------",
        env.getProperty("server.port"),
        InetAddress.getLocalHost().getHostAddress(),
        env.getProperty("server.port"));
  }
Exemple #4
0
 /** Main method, used to run the application. */
 public static void main(String[] args) throws UnknownHostException {
   SpringApplication app = new SpringApplication(Application.class);
   app.setShowBanner(false);
   SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
   addDefaultProfile(app, source);
   addLiquibaseScanPackages();
   Environment env = app.run(args).getEnvironment();
   log.info(
       "Access URLs:\n----------------------------------------------------------\n\t"
           + "Local: \t\thttp://127.0.0.1:{}\n\t"
           + "External: \thttp://{}:{}\n----------------------------------------------------------",
       env.getProperty("server.port"),
       InetAddress.getLocalHost().getHostAddress(),
       env.getProperty("server.port"));
 }
  public static void main(String[] args) throws UnknownHostException {
    // SpringApplication.run(StrartJyotiMobileApplication.class, args);
    SpringApplication app = new SpringApplication(StartJyotiMobileApplication.class);
    app.setShowBanner(false);
    app.setDefaultProperties(singletonMap("spring.config.name", "application"));

    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);
    Environment env = app.run(args).getEnvironment();
    LOGGER.info(
        "Access URLs:\n----------------------------------------------------------\n\t"
            + "Local: \t\thttp://localhost:{}{}\n\t"
            + "External: \thttp://{}:{}{}\n----------------------------------------------------------",
        env.getProperty("server.port"),
        env.getProperty("server.context-path"),
        InetAddress.getLocalHost().getHostAddress(),
        env.getProperty("server.port"),
        env.getProperty("server.context-path"));
  }
  public static void main(String[] args) throws Exception {
    // See : http://patorjk.com/software/taag/#p=display&f=Slant&t=Flamingo%20Collector
    System.out.println(
        "   _  __              ____                  _      _             _                _____                          \n"
            + "  | |/ /__  ____     / __ \\_________ _   __(_)____(_)___  ____  (_)___  ____ _   / ___/___  ______   _____  _____\n"
            + "  |   / _ \\/ __ \\   / /_/ / ___/ __ \\ | / / / ___/ / __ \\/ __ \\/ / __ \\/ __ `/   \\__ \\/ _ \\/ ___/ | / / _ \\/ ___/\n"
            + " /   /  __/ / / /  / ____/ /  / /_/ / |/ / (__  ) / /_/ / / / / / / / / /_/ /   ___/ /  __/ /   | |/ /  __/ /    \n"
            + "/_/|_\\___/_/ /_/  /_/   /_/   \\____/|___/_/____/_/\\____/_/ /_/_/_/ /_/\\__, /   /____/\\___/_/    |___/\\___/_/     \n"
            + "                                                                     /____/                                      \n");

    ////////////////////////////////////////////////////////////////////////////////////

    StringBuilder builder = new StringBuilder();
    printHeader(builder, "Application Information");

    Properties appProps = new Properties();
    Properties systemProperties = System.getProperties();
    appProps.put(
        "Java Version",
        systemProperties.getProperty("java.version", UNKNOWN)
            + " - "
            + systemProperties.getProperty("java.vendor", UNKNOWN));
    appProps.put("Current Working Directory", systemProperties.getProperty("user.dir", UNKNOWN));

    print(builder, appProps);

    Properties memPros = new Properties();
    final Runtime rt = Runtime.getRuntime();
    final long maxMemory = rt.maxMemory() / MEGA_BYTES;
    final long totalMemory = rt.totalMemory() / MEGA_BYTES;
    final long freeMemory = rt.freeMemory() / MEGA_BYTES;
    final long usedMemory = totalMemory - freeMemory;

    memPros.put("Maximum Allowable Memory", maxMemory + "MB");
    memPros.put("Total Memory", totalMemory + "MB");
    memPros.put("Free Memory", freeMemory + "MB");
    memPros.put("Used Memory", usedMemory + "MB");

    print(builder, memPros);

    printHeader(builder, "Java System Properties");
    Properties sysProps = new Properties();
    for (final Map.Entry<Object, Object> entry : systemProperties.entrySet()) {
      sysProps.put(entry.getKey(), entry.getValue());
    }

    print(builder, sysProps);

    printHeader(builder, "System Environments");
    Map<String, String> getenv = System.getenv();
    Properties envProps = new Properties();
    Set<String> strings = getenv.keySet();
    for (String key : strings) {
      String message = getenv.get(key);
      envProps.put(key, message);
    }

    print(builder, envProps);

    System.out.println(builder.toString());

    ////////////////////////////////////////////////////////////////////////////////////

    NativeLoader.loadSigarNative();

    ////////////////////////////////////////////////////////////////////////////////////

    SpringApplication app = new SpringApplication(Application.class);
    app.setShowBanner(false);
    ApplicationContext ctx = app.run(args);

    try {
      LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
      for (Logger LOGGER : context.getLoggerList()) {
        if (LOGGER instanceof ch.qos.logback.classic.Logger) {
          ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) LOGGER;
          for (Iterator<Appender<ILoggingEvent>> index = logbackLogger.iteratorForAppenders();
              index.hasNext(); ) {
            Appender<ILoggingEvent> appender = index.next();
            if ("FILE".equals(appender.getName())
                && appender instanceof ch.qos.logback.core.rolling.RollingFileAppender) {
              ch.qos.logback.core.rolling.RollingFileAppender logbackAppender =
                  (ch.qos.logback.core.rolling.RollingFileAppender) appender;
              logger.info("Log file is {}", logbackAppender.getFile());
            }
          }
        }
      }
    } catch (Exception ex) {
    }
  }
Exemple #7
0
 public static void main(String[] args) {
   SpringApplication app = new SpringApplication(App.class);
   app.setShowBanner(false);
   app.run(args);
 }
 /*
  * (非 Javadoc) <p>Title: onApplicationEvent</p> <p>Description: </p>
  *
  * @param event
  *
  * @see
  * org.springframework.context.ApplicationListener#onApplicationEvent(org.
  * springframework.context.ApplicationEvent)
  */
 @Override
 public void onApplicationEvent(ApplicationStartedEvent event) {
   SpringApplication app = event.getSpringApplication();
   app.setShowBanner(false); // 不显示banner信息
   System.out.println("==MyApplicationStartedEventListener==");
 }