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


Java SimpleCommandLinePropertySource类代码示例

本文整理汇总了Java中org.springframework.core.env.SimpleCommandLinePropertySource的典型用法代码示例。如果您正苦于以下问题:Java SimpleCommandLinePropertySource类的具体用法?Java SimpleCommandLinePropertySource怎么用?Java SimpleCommandLinePropertySource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleCommandLinePropertySource类属于org.springframework.core.env包,在下文中一共展示了SimpleCommandLinePropertySource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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"));

}
 
开发者ID:VHAINNOVATIONS,项目名称:BCDS,代码行数:19,代码来源:Application.java

示例2: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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"));


}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:20,代码来源:Application.java

示例3: run

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
@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));

}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:24,代码来源:MvcLoader.java

示例4: run

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
@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...");
}
 
开发者ID:ShiftLeftSecurity,项目名称:HelloShiftLeft,代码行数:21,代码来源:DataLoader.java

示例5: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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"));

}
 
开发者ID:jbernach,项目名称:transandalus-backend,代码行数:19,代码来源:Application.java

示例6: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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"));

}
 
开发者ID:VHAINNOVATIONS,项目名称:BCDS,代码行数:19,代码来源:Application.java

示例7: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:xetys,项目名称:jhipster-ribbon-hystrix,代码行数:26,代码来源:GatewayApp.java

示例8: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:xetys,项目名称:jhipster-ribbon-hystrix,代码行数:26,代码来源:BarApp.java

示例9: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:xetys,项目名称:jhipster-ribbon-hystrix,代码行数:26,代码来源:FooApp.java

示例10: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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"));

}
 
开发者ID:k8s-for-greeks,项目名称:gpmr,代码行数:22,代码来源:GpmrApp.java

示例11: configurePropertySources

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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));
		}
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:30,代码来源:SpringApplication.java

示例12: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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"));

}
 
开发者ID:gmarziou,项目名称:jhipster-ionic,代码行数:19,代码来源:Application.java

示例13: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
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();

}
 
开发者ID:netdava,项目名称:jbakery,代码行数:21,代码来源:Main.java

示例14: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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"));

}
 
开发者ID:dzhw,项目名称:metadatamanagement,代码行数:20,代码来源:Application.java

示例15: main

import org.springframework.core.env.SimpleCommandLinePropertySource; //导入依赖的package包/类
/**
 * 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"));

}
 
开发者ID:javicacheiro,项目名称:hadoop-on-demand-rest-jhipster,代码行数:24,代码来源:Application.java


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