本文整理汇总了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);
}
}