本文整理汇总了Java中org.springframework.core.env.Environment.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Environment.getProperty方法的具体用法?Java Environment.getProperty怎么用?Java Environment.getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.env.Environment
的用法示例。
在下文中一共展示了Environment.getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: arkClient
import org.springframework.core.env.Environment; //导入方法依赖的package包/类
@Bean
public ArkClient arkClient(Environment environment) {
ArkNetworkFactory arkNetworkFactory = new ArkNetworkFactory();
String arkNetworkConfigPath = environment.getProperty("arkNetworkConfigPath");
ArkNetwork arkNetwork = arkNetworkFactory.createFromYml(arkNetworkConfigPath);
HttpArkClientFactory httpArkClientFactory = new HttpArkClientFactory();
return httpArkClientFactory.create(arkNetwork);
}
示例2: main
import org.springframework.core.env.Environment; //导入方法依赖的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(BlogApp.class);
DefaultProfileUtil.addDefaultProfile(app);
Environment env = app.run(args).getEnvironment();
String protocol = "http";
if (env.getProperty("server.ssl.key-store") != null) {
protocol = "https";
}
log.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\t{}://localhost:{}\n\t" +
"External: \t{}://{}:{}\n\t" +
"Profile(s): \t{}\n----------------------------------------------------------",
env.getProperty("spring.application.name"),
protocol,
env.getProperty("server.port"),
protocol,
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
env.getActiveProfiles());
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);
}
示例3: main
import org.springframework.core.env.Environment; //导入方法依赖的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(JHipsterRegistryApp.class);
DefaultProfileUtil.addDefaultProfile(app);
Environment env = app.run(args).getEnvironment();
String protocol = "http";
if (env.getProperty("server.ssl.key-store") != null) {
protocol = "https";
}
log.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\t{}://localhost:{}\n\t" +
"External: \t{}://{}:{}\n\t" +
"Profile(s): \t{}\n----------------------------------------------------------",
env.getProperty("spring.application.name"),
protocol,
env.getProperty("server.port"),
protocol,
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
env.getActiveProfiles());
String secretKey = env.getProperty("jhipster.security.authentication.jwt.secret");
if (secretKey == null ) {
log.error("\n----------------------------------------------------------\n" +
"Your JWT secret key is not set up, you will not be able to log into the JHipster.\n"+
"Please read the documentation at https://jhipster.github.io/jhipster-registry/\n" +
"----------------------------------------------------------");
} else if (secretKey.equals("this-secret-should-not-be-used-read-the-comment")) {
log.error("\n----------------------------------------------------------\n" +
"Your JWT secret key is not configured using Spring Cloud Config, you will not be able to \n"+
"use the JHipster Registry dashboards to monitor external applications. \n" +
"Please read the documentation at https://jhipster.github.io/jhipster-registry/\n" +
"----------------------------------------------------------");
}
}
示例4: main
import org.springframework.core.env.Environment; //导入方法依赖的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(StoreApp.class);
DefaultProfileUtil.addDefaultProfile(app);
Environment env = app.run(args).getEnvironment();
String protocol = "http";
if (env.getProperty("server.ssl.key-store") != null) {
protocol = "https";
}
log.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\t{}://localhost:{}\n\t" +
"External: \t{}://{}:{}\n\t" +
"Profile(s): \t{}\n----------------------------------------------------------",
env.getProperty("spring.application.name"),
protocol,
env.getProperty("server.port"),
protocol,
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
env.getActiveProfiles());
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);
}
示例5: main
import org.springframework.core.env.Environment; //导入方法依赖的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(GateApp.class);
DefaultProfileUtil.addDefaultProfile(app);
Environment env = app.run(args).getEnvironment();
String protocol = "http";
if (env.getProperty("server.ssl.key-store") != null) {
protocol = "https";
}
log.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\t{}://localhost:{}\n\t" +
"External: \t{}://{}:{}\n\t" +
"Profile(s): \t{}\n----------------------------------------------------------",
env.getProperty("spring.application.name"),
protocol,
env.getProperty("server.port"),
protocol,
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
env.getActiveProfiles());
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);
}
示例6: JwtTokenUtil
import org.springframework.core.env.Environment; //导入方法依赖的package包/类
@Autowired
public JwtTokenUtil(Environment env) {
String s = null;
if (env != null) {
s = env.getProperty("sta.jwtSecret", "ReplaceMeWithSomethingLongArbitraryAndHardToGuess");
} else {
s = "G#tg$%GH5Ju6k*k*(o886%&U^4y%#t$$#[email protected]%J67j^k&*k97l9&7k5H4";
}
secret = s;
}
示例7: arkClient
import org.springframework.core.env.Environment; //导入方法依赖的package包/类
@Bean
public ArkClient arkClient(Environment environment) {
// todo: we should probably just network config in json format so it can directly consume ark-node configs
String arkNetworkName = environment.getProperty("arkNetwork.name");
ArkNetwork arkNetwork = new ArkNetworkFactory()
.createFromYml("ark-config/" + arkNetworkName + ".yml");
RestTemplate restTemplate = new RestTemplateBuilder().build();
return new HttpArkClient(arkNetwork, restTemplate);
}
示例8: main
import org.springframework.core.env.Environment; //导入方法依赖的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(BalanceApp.class);
DefaultProfileUtil.addDefaultProfile(app);
Environment env = app.run(args).getEnvironment();
String protocol = "http";
if (env.getProperty("server.ssl.key-store") != null) {
protocol = "https";
}
log.info("\n----------------------------------------------------------\n\t"
+ "Application '{}' is running! Access URLs:\n\t"
+ "Local: \t\t{}://localhost:{}\n\t"
+ "External: \t{}://{}:{}\n\t"
+ "Profile(s): \t{}\n----------------------------------------------------------",
env.getProperty("spring.application.name"),
protocol,
env.getProperty("server.port"),
protocol,
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
env.getActiveProfiles());
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: getStringSetting
import org.springframework.core.env.Environment; //导入方法依赖的package包/类
private static String getStringSetting(Environment environment, String settingName) {
String result = environment.getProperty(settingName);
if (result != null && result.isEmpty()) {
result = null;
}
return result;
}
示例10: DropSchemaResolver
import org.springframework.core.env.Environment; //导入方法依赖的package包/类
public DropSchemaResolver(Environment env) {
String db = env.getProperty("spring.jpa.database");
this.dbDropSchemaCommand = DBCOMMANDS.getOrDefault(db, DEFAULT_COMMAND);
log.info("Database {} will use command '{}' for drop schema", db, dbDropSchemaCommand);
}
示例11: serviceArkAddress
import org.springframework.core.env.Environment; //导入方法依赖的package包/类
@Bean
public String serviceArkAddress(Environment environment) {
return environment.getProperty("ethBridge.serviceArkWallet.address");
}
示例12: dbUrl
import org.springframework.core.env.Environment; //导入方法依赖的package包/类
@Bean
public String dbUrl(Environment env) {
return POSTGRES_URI_SCHEME + "://" + env.getProperty(POSTGRES_HOST_KEY) + ":" + Integer.parseInt(env.getProperty(POSTGRES_PORT_KEY));
}
示例13: scriptPath
import org.springframework.core.env.Environment; //导入方法依赖的package包/类
@Bean
public String scriptPath(Environment environment) {
return environment.getProperty("ethBridge.scriptPath");
}
示例14: SchemaChangeResolver
import org.springframework.core.env.Environment; //导入方法依赖的package包/类
public SchemaChangeResolver(Environment env) {
String db = env.getProperty("spring.jpa.database");
this.dbSchemaChangeCommand = DBCOMMANDS.getOrDefault(db, DEFAULT_COMMAND);
log.info("Database {} will use command '{}' for schema changing", db, dbSchemaChangeCommand);
}
示例15: SchemaChangeResolver
import org.springframework.core.env.Environment; //导入方法依赖的package包/类
/**
* SchemaChangeResolver constructor.
* @param env the environment
*/
public SchemaChangeResolver(Environment env) {
String db = env.getProperty("spring.jpa.database");
this.dbSchemaChangeCommand = DBCOMMANDS.getOrDefault(db, DEFAULT_COMMAND);
log.info("Database {} will use command '{}' for schema changing", db, dbSchemaChangeCommand);
}