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


Java Environment.getProperty方法代码示例

本文整理汇总了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);
}
 
开发者ID:ark-aces,项目名称:aces-listener-ark,代码行数:10,代码来源:ApplicationConfig.java

示例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);
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:33,代码来源:BlogApp.java

示例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" +
            "----------------------------------------------------------");
    }
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:42,代码来源:JHipsterRegistryApp.java

示例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);
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:33,代码来源:StoreApp.java

示例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);
}
 
开发者ID:xm-online,项目名称:xm-gate,代码行数:33,代码来源:GateApp.java

示例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;
}
 
开发者ID:kinota,项目名称:kinota-server,代码行数:11,代码来源:JwtTokenUtil.java

示例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);
}
 
开发者ID:bradyo,项目名称:ark-java-smart-bridge-listener,代码行数:12,代码来源:ApplicationConfig.java

示例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);
}
 
开发者ID:xm-online,项目名称:xm-ms-balance,代码行数:33,代码来源:BalanceApp.java

示例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;
}
 
开发者ID:marrow16,项目名称:ColorConverter,代码行数:8,代码来源:Configuration.java

示例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);
}
 
开发者ID:xm-online,项目名称:xm-ms-dashboard,代码行数:6,代码来源:DropSchemaResolver.java

示例11: serviceArkAddress

import org.springframework.core.env.Environment; //导入方法依赖的package包/类
@Bean
public String serviceArkAddress(Environment environment) {
    return environment.getProperty("ethBridge.serviceArkWallet.address");
}
 
开发者ID:ark-aces,项目名称:aces-backend,代码行数:5,代码来源:EthBridgeConfig.java

示例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));
}
 
开发者ID:cf-platform-eng,项目名称:my-postgres-broker,代码行数:5,代码来源:TestConfig.java

示例13: scriptPath

import org.springframework.core.env.Environment; //导入方法依赖的package包/类
@Bean
public String scriptPath(Environment environment) {
    return environment.getProperty("ethBridge.scriptPath");
}
 
开发者ID:ark-aces,项目名称:aces-backend,代码行数:5,代码来源:EthBridgeConfig.java

示例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);
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:6,代码来源:SchemaChangeResolver.java

示例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);
}
 
开发者ID:xm-online,项目名称:xm-ms-balance,代码行数:10,代码来源:SchemaChangeResolver.java


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