本文整理了Java中io.micronaut.context.env.Environment.containsProperty()
方法的一些代码示例,展示了Environment.containsProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.containsProperty()
方法的具体详情如下:
包路径:io.micronaut.context.env.Environment
类名称:Environment
方法名:containsProperty
暂无
代码示例来源:origin: micronaut-projects/micronaut-core
@Override
public boolean matches(ConditionContext context) {
AnnotationMetadataProvider component = context.getComponent();
BeanContext beanContext = context.getBeanContext();
if (beanContext instanceof ApplicationContext) {
Environment env = ((ApplicationContext) beanContext).getEnvironment();
if (component instanceof ValueResolver) {
Optional<String> optional = ((ValueResolver) component).get(Named.class.getName(), String.class);
if (optional.isPresent()) {
String serviceName = optional.get();
String urlProp = ServiceHttpClientConfiguration.PREFIX + "." + serviceName + ".url";
return env.containsProperty(urlProp) || env.containsProperty(urlProp + "s");
}
}
}
return true;
}
}
代码示例来源:origin: micronaut-projects/micronaut-spring
@Override
public void validateRequiredProperties() throws MissingRequiredPropertiesException {
if (requiredProperties != null) {
Set<String> missingProps = new HashSet<>();
for (String requiredProperty : requiredProperties) {
if (!environment.containsProperty(requiredProperty)) {
missingProps.add(requiredProperty);
}
}
if (!missingProps.isEmpty()) {
throw new MissingRequiredPropertiesException() {
@Override
public Set<String> getMissingRequiredProperties() {
return missingProps;
}
};
}
}
}
}
代码示例来源:origin: io.micronaut/micronaut-inject
@Override
public boolean containsProperty(String name) {
return getEnvironment().containsProperty(name);
}
代码示例来源:origin: io.micronaut/inject
@Override
public boolean containsProperty(String name) {
return getEnvironment().containsProperty(name);
}
代码示例来源:origin: micronaut-projects/micronaut-spring
@Override
public boolean containsProperty(String key) {
return environment.containsProperty(key) || environment.containsProperties(key);
}
代码示例来源:origin: io.micronaut/http-client
@Override
public boolean matches(ConditionContext context) {
AnnotationMetadataProvider component = context.getComponent();
BeanContext beanContext = context.getBeanContext();
if (beanContext instanceof ApplicationContext) {
Environment env = ((ApplicationContext) beanContext).getEnvironment();
if (component instanceof ValueResolver) {
Optional<String> optional = ((ValueResolver) component).get(Named.class.getName(), String.class);
if (optional.isPresent()) {
String serviceName = optional.get();
String urlProp = ServiceHttpClientConfiguration.PREFIX + "." + serviceName + ".url";
return env.containsProperty(urlProp) || env.containsProperty(urlProp + "s");
}
}
}
return true;
}
}
代码示例来源:origin: io.micronaut/micronaut-http-client
@Override
public boolean matches(ConditionContext context) {
AnnotationMetadataProvider component = context.getComponent();
BeanContext beanContext = context.getBeanContext();
if (beanContext instanceof ApplicationContext) {
Environment env = ((ApplicationContext) beanContext).getEnvironment();
if (component instanceof ValueResolver) {
Optional<String> optional = ((ValueResolver) component).get(Named.class.getName(), String.class);
if (optional.isPresent()) {
String serviceName = optional.get();
String urlProp = ServiceHttpClientConfiguration.PREFIX + "." + serviceName + ".url";
return env.containsProperty(urlProp) || env.containsProperty(urlProp + "s");
}
}
}
return true;
}
}
内容来源于网络,如有侵权,请联系作者删除!