/** * Main method, used to run the application. */ public static void main(String[] args) throws UnknownHostException { SpringApplication app = new SpringApplication(Application.class); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); 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----------------------------------------------------------"+ "game-resources: {}", env.getProperty("server.port"), InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"), env.getProperty("buenojo.gameResourcesBasePath")+"/"+env.getProperty("buenojo.gameResourcesFolder")); }
@Override public void run(String... args) throws Exception { StringBuilder sb = new StringBuilder(); for (String option : args) { sb.append(" ").append(option); } sb = sb.length() == 0 ? sb.append("No Options Specified") : sb; logger.info(String.format("App launched with following arguments: %s", sb.toString())); PropertySource<?> ps = new SimpleCommandLinePropertySource(args); String appUrl = (String) ps.getProperty("appurl"); if (appUrl != null) logger.info(String.format("Command-line appurl is %s", appUrl)); String applicationPropertyUrl = environment.getProperty("spring.application.url"); logger.info(String.format("Current Spring Social ApplicationUrl is %s", applicationPropertyUrl)); String applicationVersion = environment.getProperty("nixmash.blog.mvc.version"); logger.info(String.format("NixMash MVC Application Version: %s", applicationVersion)); }
@Override public void run(String... arg0) throws Exception { SimpleCommandLinePropertySource ps = new SimpleCommandLinePropertySource(arg0); String encryptor = (String) ps.getProperty("jasypt.encryptor.password"); log.info("JASP Master Creds is {}", encryptor); connectToMySQL(); connectToAws(); log.debug("Loading test data..."); for (Customer customer : dataBuilder.createCustomers()) { customerRepository.save(customer); } for (Patient patient : dataBuilder.createPatients()) { patientRepository.save(patient); } log.debug("Test data loaded..."); }
/** * Main method, used to run the application. */ public static void main(String[] args) throws UnknownHostException { SpringApplication app = new SpringApplication(Application.class); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); 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")); }
/** * 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")); }
/** * 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(); LOGGER.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")); }
/** * Main method, used to run the application. * * @param args the command line arguments * @throws UnknownHostException if the local host name could not be resolved into an address */ public static void main(String[] args) throws UnknownHostException { SpringApplication app = new SpringApplication(GatewayApp.class); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); Environment env = app.run(args).getEnvironment(); log.info("\n----------------------------------------------------------\n\t" + "Application '{}' is running! Access URLs:\n\t" + "Local: \t\thttp://127.0.0.1:{}\n\t" + "External: \thttp://{}:{}\n----------------------------------------------------------", env.getProperty("spring.application.name"), env.getProperty("server.port"), InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port")); String configServerStatus = env.getProperty("configserver.status"); log.info("\n----------------------------------------------------------\n\t" + "Config Server: \t{}\n----------------------------------------------------------", configServerStatus == null ? "Not found or not setup for this application" : configServerStatus); }
/** * Main method, used to run the application. * * @param args the command line arguments * @throws UnknownHostException if the local host name could not be resolved into an address */ public static void main(String[] args) throws UnknownHostException { SpringApplication app = new SpringApplication(BarApp.class); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); Environment env = app.run(args).getEnvironment(); log.info("\n----------------------------------------------------------\n\t" + "Application '{}' is running! Access URLs:\n\t" + "Local: \t\thttp://127.0.0.1:{}\n\t" + "External: \thttp://{}:{}\n----------------------------------------------------------", env.getProperty("spring.application.name"), env.getProperty("server.port"), InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port")); String configServerStatus = env.getProperty("configserver.status"); log.info("\n----------------------------------------------------------\n\t" + "Config Server: \t{}\n----------------------------------------------------------", configServerStatus == null ? "Not found or not setup for this application" : configServerStatus); }
/** * Main method, used to run the application. * * @param args the command line arguments * @throws UnknownHostException if the local host name could not be resolved into an address */ public static void main(String[] args) throws UnknownHostException { SpringApplication app = new SpringApplication(FooApp.class); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); Environment env = app.run(args).getEnvironment(); log.info("\n----------------------------------------------------------\n\t" + "Application '{}' is running! Access URLs:\n\t" + "Local: \t\thttp://127.0.0.1:{}\n\t" + "External: \thttp://{}:{}\n----------------------------------------------------------", env.getProperty("spring.application.name"), env.getProperty("server.port"), InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port")); String configServerStatus = env.getProperty("configserver.status"); log.info("\n----------------------------------------------------------\n\t" + "Config Server: \t{}\n----------------------------------------------------------", configServerStatus == null ? "Not found or not setup for this application" : configServerStatus); }
/** * Main method, used to run the application. * * @param args the command line arguments * @throws UnknownHostException if the local host name could not be resolved into an address */ public static void main(String[] args) throws UnknownHostException { SpringApplication app = new SpringApplication(GpmrApp.class); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); Environment env = app.run(args).getEnvironment(); log.info("\n----------------------------------------------------------\n\t" + "Application '{}' is running! Access URLs:\n\t" + "Local: \t\thttp://127.0.0.1:{}\n\t" + "External: \thttp://{}:{}\n----------------------------------------------------------", env.getProperty("spring.application.name"), env.getProperty("server.port"), InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port")); }
/** * Add, remove or re-order any {@link PropertySource}s in this application's * environment. * @param environment this application's environment * @param args arguments passed to the {@code run} method * @see #configureEnvironment(ConfigurableEnvironment, String[]) */ protected void configurePropertySources(ConfigurableEnvironment environment, String[] args) { MutablePropertySources sources = environment.getPropertySources(); if (this.defaultProperties != null && !this.defaultProperties.isEmpty()) { sources.addLast( new MapPropertySource("defaultProperties", this.defaultProperties)); } if (this.addCommandLineProperties && args.length > 0) { String name = CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME; if (sources.contains(name)) { PropertySource<?> source = sources.get(name); CompositePropertySource composite = new CompositePropertySource(name); composite.addPropertySource(new SimpleCommandLinePropertySource( name + "-" + args.hashCode(), args)); composite.addPropertySource(source); sources.replace(name, composite); } else { sources.addFirst(new SimpleCommandLinePropertySource(args)); } } }
/** * 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 Exception { String jbakeryHome = ensureJbakeryHomeIsSet(); System.setProperty("log4j.configurationFile", log4jConfigPath(jbakeryHome)); log.info("Working directory {}", System.getProperty("user.dir")); log.info("JBAKERY_HOME is {}", jbakeryHome); // bootstrap application with Spring. String jbakeryConfigPath = jbakeryConfigPath(jbakeryHome); log.info("Using config file {}", jbakeryConfigPath); System.setProperty("spring.config.name", jbakeryConfigPath); CommandLinePropertySource clps = new SimpleCommandLinePropertySource(args); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.getEnvironment().getPropertySources().addFirst(clps); context.registerShutdownHook(); context.register(Config.class); context.refresh(); }
/** * Main method, used to run the application. */ public static void main(String[] args) throws UnknownHostException { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); SpringApplication app = new SpringApplication(Application.class); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); 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")); }
/** * 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); // Check if the selected profile has been set as argument. // if not the development profile will be added 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")); }
/** * Main method, used to run the application. */ public static void main(String[] args) throws UnknownHostException { SpringApplication app = new SpringApplication(Application.class); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); Environment env = app.run(args).getEnvironment(); String protocol = env.containsProperty("server.ssl.key-store") ? "https" : "http"; log.info("Access URLs:\n----------------------------------------------------------\n\t" + "Local: \t\t{}://localhost:{}{}\n\t" + "External: \t{}://{}:{}{}\n----------------------------------------------------------", protocol, env.getProperty("server.port"), env.getProperty("server.contextPath", ""), protocol, InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"), env.getProperty("server.contextPath", "")); }
/** * 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.setShowBanner(true); 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); }
/** * 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); }
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); // Fallback to set the list of liquibase package list . addLiquibaseScanPackages(); ConfigurableApplicationContext applicationContext = app.run(args); try { SpringLoadedAgent.getInstrumentation(); log.info("Spring Loaded is running, registering hot reloading features"); JHipsterPluginManagerReloadPlugin.register(applicationContext); } catch (UnsupportedOperationException uoe) { log.info("Spring Loaded is not running, hot reloading is not enabled"); } }
/** * 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.jar -noverify -Dspringloaded=plugins=com.mycompany.myapp.config.reload.instrument.JHipsterLoadtimeInstrumentationPlugin" */ 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); // Fallback to set the list of liquibase package list addLiquibaseScanPackages(); app.run(args); }
protected static void abstractMain(SpringApplication app, String[] args) throws UnknownHostException { SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); //addLiquibaseScanPackages(); staticEnv = app.run(args).getEnvironment(); showAppInfo(staticEnv); }
/** * If no profile has been configured, set by default the "dev" profile. */ protected static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) { if ((System.getProperty("spring.profiles.active") == null) && !source.containsProperty("spring.profiles.active") && !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) { app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT); } }
/** * If no profile has been configured, set by default the "dev" profile. */ private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) { if (!source.containsProperty("spring.profiles.active") && !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) { app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT); } }
public static void main(String[] args) throws Exception { PropertySource commandLineProperties = new SimpleCommandLinePropertySource(args); AnnotationConfigApplicationContext context= new AnnotationConfigApplicationContext(); context.getEnvironment().getPropertySources().addFirst(commandLineProperties); context.register(ApplicationConfiguration.class); context.refresh(); }
private static boolean doReIndex(String[] args) { PropertySource ps = new SimpleCommandLinePropertySource(args); if (ps.getProperty("reindex") == null) return false; else return Boolean.valueOf(ps.getProperty("reindex").toString()); }