本文整理了Java中io.micronaut.context.env.Environment.getActiveNames()
方法的一些代码示例,展示了Environment.getActiveNames()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getActiveNames()
方法的具体详情如下:
包路径:io.micronaut.context.env.Environment
类名称:Environment
方法名:getActiveNames
[英]Should respect the order as provided.
[中]应遵守规定的订单。
代码示例来源:origin: micronaut-projects/micronaut-core
this.specifiedPort = configPort.get();
} else {
if (environment.getActiveNames().contains(Environment.TEST)) {
this.specifiedPort = -1;
} else {
代码示例来源:origin: micronaut-projects/micronaut-core
return Flowable.empty();
Set<String> activeNames = environment.getActiveNames();
Optional<String> serviceId = Optional.ofNullable(this.serviceId);
代码示例来源:origin: micronaut-projects/micronaut-core
Set<String> activeNames = environment.getActiveNames();
Optional<String> serviceId = consulConfiguration.getServiceId();
ConsulConfiguration.ConsulConfigDiscoveryConfiguration configDiscoveryConfiguration = consulConfiguration.getConfiguration();
代码示例来源:origin: micronaut-projects/micronaut-core
} else {
String applicationName = configuredApplicationName.get();
Set<String> activeNames = environment.getActiveNames();
String profiles = String.join(",", activeNames);
代码示例来源:origin: micronaut-projects/micronaut-spring
private boolean isProfileActive(String profile) {
Set<String> currentActiveProfiles = environment.getActiveNames();
return currentActiveProfiles.contains(profile);
}
代码示例来源:origin: micronaut-projects/micronaut-spring
@Override
public String[] getActiveProfiles() {
return environment.getActiveNames().toArray(new String[0]);
}
代码示例来源:origin: micronaut-projects/micronaut-spring
@Override
public boolean acceptsProfiles(@NonNull String... profiles) {
Assert.notNull(profiles, "Profiles must not be null");
return Arrays.stream(profiles).anyMatch(p -> environment.getActiveNames().contains(p));
}
代码示例来源:origin: io.micronaut/runtime
/**
* Default handling of startup exceptions.
*
* @param environment The environment
* @param exception The exception
* @throws ApplicationStartupException If the server cannot be shutdown with an appropriate exist code
*/
protected void handleStartupException(Environment environment, Throwable exception) {
Function<Throwable, Integer> exitCodeMapper = exitHandlers.computeIfAbsent(exception.getClass(), exceptionType -> (throwable -> 1));
Integer code = exitCodeMapper.apply(exception);
if (code > 0) {
if (!environment.getActiveNames().contains(Environment.TEST)) {
if (LOG.isErrorEnabled()) {
LOG.error("Error starting Micronaut server: " + exception.getMessage(), exception);
}
System.exit(code);
}
}
throw new ApplicationStartupException("Error starting Micronaut server: " + exception.getMessage(), exception);
}
}
代码示例来源:origin: io.micronaut/inject
ApplicationContext applicationContext = (ApplicationContext) beanContext;
Environment environment = applicationContext.getEnvironment();
Set<String> activeNames = environment.getActiveNames();
boolean result = Arrays.stream(env).anyMatch(s -> !activeNames.contains(s));
if (!result) {
ApplicationContext applicationContext = (ApplicationContext) beanContext;
Environment environment = applicationContext.getEnvironment();
Set<String> activeNames = environment.getActiveNames();
boolean result = Arrays.stream(env).anyMatch(activeNames::contains);
if (!result) {
代码示例来源:origin: io.micronaut/micronaut-inject
ApplicationContext applicationContext = (ApplicationContext) beanContext;
Environment environment = applicationContext.getEnvironment();
Set<String> activeNames = environment.getActiveNames();
boolean result = Arrays.stream(env).noneMatch(activeNames::contains);
if (!result) {
ApplicationContext applicationContext = (ApplicationContext) beanContext;
Environment environment = applicationContext.getEnvironment();
Set<String> activeNames = environment.getActiveNames();
boolean result = Arrays.stream(env).anyMatch(activeNames::contains);
if (!result) {
内容来源于网络,如有侵权,请联系作者删除!