org.springframework.core.env.SimpleCommandLinePropertySource#containsProperty ( )源码实例Demo

下面列出了org.springframework.core.env.SimpleCommandLinePropertySource#containsProperty ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: seed   文件: OpenRun.java
private static String getProfile(SimpleCommandLinePropertySource source){
    if(source.containsProperty(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到spring变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, source.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return source.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getProperties().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到java变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getenv().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到系统变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getenv(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getenv(SeedConstants.BOOT_ACTIVE_NAME);
    }
    log.warn("未读取到{},默认取环境:{}", SeedConstants.BOOT_ACTIVE_NAME, SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE);
    return SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE;
}
 
源代码2 项目: seed   文件: QssRun.java
private static String getProfile(SimpleCommandLinePropertySource source){
    if(source.containsProperty(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到spring变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, source.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return source.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getProperties().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到java变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getenv().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到系统变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getenv(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getenv(SeedConstants.BOOT_ACTIVE_NAME);
    }
    log.warn("未读取到{},默认取环境:{}", SeedConstants.BOOT_ACTIVE_NAME, SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE);
    return SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE;
}
 
源代码3 项目: seed   文件: BootRun.java
private static String getProfile(SimpleCommandLinePropertySource source){
    if(source.containsProperty(SeedConstants.BOOT_ACTIVE_NAME)){
        //补充:IntelliJ IDEA运行时,如果在Run/Debug Configurations为该启动类配置Program arguments的值为"--spring.profiles.active=dev"
        //那么这里就能读取到该配置,同时控制台会打印"读取到spring变量:spring.profiles.active=dev"
        log.info("读取到spring变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, source.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return source.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getProperties().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到java变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getenv().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到系统变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getenv(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getenv(SeedConstants.BOOT_ACTIVE_NAME);
    }
    log.warn("未读取到{},默认取环境:{}", SeedConstants.BOOT_ACTIVE_NAME, SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE);
    //logback-boot.xml中根据环境变量配置日志是否输出到控制台时,使用此配置
    System.setProperty(SeedConstants.BOOT_ACTIVE_NAME, SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE);
    return SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE;
}
 
源代码4 项目: seed   文件: MppRun.java
private static String getProfile(SimpleCommandLinePropertySource source){
    if(source.containsProperty(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到spring变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, source.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return source.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getProperties().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到java变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getenv().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到系统变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getenv(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getenv(SeedConstants.BOOT_ACTIVE_NAME);
    }
    log.warn("未读取到{},默认取环境:{}", SeedConstants.BOOT_ACTIVE_NAME, SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE);
    return SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE;
}
 
源代码5 项目: jhipster-ribbon-hystrix   文件: GatewayApp.java
/**
 * 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);
    }
}
 
源代码6 项目: jhipster-ribbon-hystrix   文件: BarApp.java
/**
 * 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);
    }
}
 
源代码7 项目: jhipster-ribbon-hystrix   文件: FooApp.java
/**
 * 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);
    }
}
 
源代码8 项目: huanhuan-blog   文件: AbstractApplication.java
/**
 * 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);
    }
}
 
源代码9 项目: gpmr   文件: GpmrApp.java
/**
 * 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);
    }
}
 
/**
 * 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);
    }
}
 
源代码11 项目: todo-spring-angular   文件: Application.java
/**
 * 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);
    }
}
 
/**
 * 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);
    }
}
 
源代码13 项目: ServiceCutter   文件: Application.java
/**
 * 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);
    }
}
 
源代码14 项目: expper   文件: Application.java
/**
 * 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);
    }
}