當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleCommandLinePropertySource.containsProperty方法代碼示例

本文整理匯總了Java中org.springframework.core.env.SimpleCommandLinePropertySource.containsProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleCommandLinePropertySource.containsProperty方法的具體用法?Java SimpleCommandLinePropertySource.containsProperty怎麽用?Java SimpleCommandLinePropertySource.containsProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.core.env.SimpleCommandLinePropertySource的用法示例。


在下文中一共展示了SimpleCommandLinePropertySource.containsProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:heikehuan,項目名稱:fly4j,代碼行數:11,代碼來源:AbstractApplication.java

示例2: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:GastonMauroDiaz,項目名稱:buenojo,代碼行數:11,代碼來源:Application.java

示例3: onApplicationEvent

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
@SuppressWarnings("ALL")
@Override
public void onApplicationEvent(ApplicationFailedEvent event) {

    SimpleCommandLinePropertySource commandLinePropertySource = new SimpleCommandLinePropertySource(event.getArgs());


    if (commandLinePropertySource.containsProperty("ding-url")) {
        final String name = ListenerUtils.getServerName(commandLinePropertySource.getProperty("ding-app-name"));

        //ding-url  ding-msg
        Map<String, Object> map = of(
                "msgtype", "text",
                "text", of("content", "【[對不起]】" + name + "啟動失敗。")
        );

        new Thread() {
            @Override
            public void run() {
                super.run();
                String url = commandLinePropertySource.getProperty("ding-url");
                try {
                    String returnString = Request.Post(url).connectTimeout(8000)
                            .bodyString(JSON.toJSONString(map), ContentType.APPLICATION_JSON).execute().returnContent().asString();
                    log.info("釘釘通知已發送 return:" + returnString);
                } catch (Exception e) {
                    log.warn("發送釘釘通知失敗", e);
                }
            }
        }.start();
    }
}
 
開發者ID:chenjazz,項目名稱:DingTalkRobot-SpringBoot,代碼行數:33,代碼來源:MyFailListener.java

示例4: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:quanticc,項目名稱:ugc-bot-redux,代碼行數:11,代碼來源:Application.java

示例5: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
/**
 * If no profile has been configured, set by default the "local" 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_LOCAL);
    }
}
 
開發者ID:VHAINNOVATIONS,項目名稱:BCDS,代碼行數:10,代碼來源:Application.java

示例6: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
/**
 * If no profile has been configured, set by default the "local" profile.
 */
protected static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active") &&
            !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {
        app.setAdditionalProfiles(Constants.SPRING_PROFILE_LOCAL);
    }
}
 
開發者ID:VHAINNOVATIONS,項目名稱:BCDS,代碼行數:10,代碼來源:BaseApplication.java

示例7: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
/**
 * 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);
	}
}
 
開發者ID:giovannicandido,項目名稱:audit-mq-collector,代碼行數:11,代碼來源:AuditMQCollector.java

示例8: loadConfigurationProperties

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
private Properties loadConfigurationProperties(SimpleCommandLinePropertySource cmdSource, Properties defaultProps) throws IOException {
	Properties properties = new Properties(defaultProps);
	if(cmdSource.containsProperty(CONF_OPT)) {
		String configTextPath = cmdSource.getProperty(CONF_OPT);
		String configTextAsResourcePath = guessResourceUri(configTextPath);
		Properties fileProperties = ResourceUtils.asProperties(configTextAsResourcePath);
		properties.putAll(fileProperties);
	} else {
		LOGGER.debug("No property {} presented, using defaults", CONF_OPT);
	}
	return properties;
}
 
開發者ID:kucera-jan-cz,項目名稱:esBench,代碼行數:13,代碼來源:EsBenchCommandLine.java

示例9: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
/**
 * If no profile has been configured, set by default the "local" 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_LOCAL);
  }
}
 
開發者ID:dzhw,項目名稱:metadatamanagement,代碼行數:12,代碼來源:Application.java

示例10: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
/**
 * 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);
	}
}
 
開發者ID:tinesoft,項目名稱:droidlinguist,代碼行數:11,代碼來源:DroidLinguistApplication.java

示例11: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
/**
 * Set a default profile if it has not been set
 */
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active")) {
        app.setAdditionalProfiles("local");
        LOGGER.info("Staring application with profiles: local");
    } else {
        LOGGER.info("Staring application with profiles: {}", source.getProperty("spring.profiles.active"));
    }
}
 
開發者ID:jfcorugedo,項目名稱:RJavaServer,代碼行數:12,代碼來源:Application.java

示例12: onApplicationEvent

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
@Override
public void onApplicationEvent(ApplicationStartingEvent event) {

    SimpleCommandLinePropertySource commandLinePropertySource = new SimpleCommandLinePropertySource(event.getArgs());

    if (commandLinePropertySource.containsProperty("ding-url")) {

        final String name = ListenerUtils.getServerName(commandLinePropertySource.getProperty("ding-app-name"));

        //ding-url  ding-msg
        Map<String, Object> map = of(
                "msgtype", "text",
                "text", of("content", "【[出差]】" + name + "正在啟動。\n 當前時間:" +
                        LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss")))
        );

        new Thread() {
            @Override
            public void run() {
                super.run();
                String url = commandLinePropertySource.getProperty("ding-url");
                try {
                    String returnString = Request.Post(url).connectTimeout(8000)
                            .bodyString(JSON.toJSONString(map), ContentType.APPLICATION_JSON).execute().returnContent().asString();
                    if (log.isInfoEnabled()) {
                        log.info("釘釘通知已發送 return:" + returnString);
                    } else {
                        System.out.println("釘釘通知已發送 return: + returnString");
                    }
                } catch (Exception e) {
                    log.warn("發送釘釘通知失敗", e);
                }
            }
        }.start();
    } else {
        if (log.isInfoEnabled()) {
            log.info("程序開始啟動:釘釘群通知命令行參數 [--ding-url],[--ding-app-name]未配置");
        } else {
            System.out.println("程序開始啟動:釘釘群通知命令行參數 [--ding-url],[--ding-app-name]未配置");
        }
    }
}
 
開發者ID:chenjazz,項目名稱:DingTalkRobot-SpringBoot,代碼行數:43,代碼來源:MyStartListener.java

示例13: argumentsDoesNotContainProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
private static boolean argumentsDoesNotContainProfile(final String... args) {
	final SimpleCommandLinePropertySource argsSource = new SimpleCommandLinePropertySource(args);
	return !argsSource.containsProperty(SPRING_PROFILES_ACTIVE);
}
 
開發者ID:JanLoebel,項目名稱:uaa-service,代碼行數:5,代碼來源:DefaultProfileUtils.java

示例14: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
/**
 * Set a default profile if it has not been set
 */
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
  if (!source.containsProperty("spring.profiles.active")) {
    app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
  }
}
 
開發者ID:EMN-FILA2-2015,項目名稱:telosys-tools-saas-back,代碼行數:9,代碼來源:Application.java

示例15: addDefaultProfile

import org.springframework.core.env.SimpleCommandLinePropertySource; //導入方法依賴的package包/類
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
  if (!source.containsProperty("spring.profiles.active") && !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {
    app.setAdditionalProfiles(SPRING_PROFILE_DEVELOPMENT);
  }
}
 
開發者ID:priitl,項目名稱:p2p-webtv,代碼行數:6,代碼來源:Application.java


注:本文中的org.springframework.core.env.SimpleCommandLinePropertySource.containsProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。