本文整理汇总了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"));
}
示例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"));
}
示例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));
}
示例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...");
}
示例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"));
}
示例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"));
}
示例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);
}
示例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);
}
示例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);
}
示例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"));
}
示例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"));
}
示例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();
}
示例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"));
}
示例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"));
}