本文整理匯總了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);
}
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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"));
}
}
示例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]未配置");
}
}
}
示例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);
}
示例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);
}
}
示例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);
}
}