io.micronaut.context.env.Environment.addPropertySource()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中io.micronaut.context.env.Environment.addPropertySource()方法的一些代码示例,展示了Environment.addPropertySource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.addPropertySource()方法的具体详情如下:
包路径:io.micronaut.context.env.Environment
类名称:Environment
方法名:addPropertySource

Environment.addPropertySource介绍

[英]Add a property source for the given map.
[中]为给定映射添加属性源。

代码示例

代码示例来源:origin: micronaut-projects/micronaut-core

/**
   * Start the environment specified.
   * @param applicationContext the application context with the environment
   * @return The environment within the context
   */
  protected Environment startEnvironment(ApplicationContext applicationContext) {
    if (!applicationContext.isRunning()) {
      if (this instanceof PropertySource) {
        applicationContext.getEnvironment().addPropertySource((PropertySource) this);
      }

      return applicationContext
          .start()
          .getEnvironment();
    } else {
      return applicationContext.getEnvironment();
    }
  }
}

代码示例来源:origin: io.micronaut/inject

/**
 * Add a property source for the given map.
 *
 * @param name   The name
 * @param values The values
 * @return This environment
 */
default Environment addPropertySource(String name, @Nullable Map<String, ? super Object> values) {
  if (StringUtils.isNotEmpty(name) && CollectionUtils.isNotEmpty(values)) {
    return addPropertySource(PropertySource.of(name, values));
  }
  return this;
}

代码示例来源:origin: io.micronaut/micronaut-inject

/**
 * Add a property source for the given map.
 *
 * @param name   The name
 * @param values The values
 * @return This environment
 */
default Environment addPropertySource(String name, @Nullable Map<String, ? super Object> values) {
  if (StringUtils.isNotEmpty(name) && CollectionUtils.isNotEmpty(values)) {
    return addPropertySource(PropertySource.of(name, values));
  }
  return this;
}

代码示例来源:origin: io.micronaut/inject

environment.addPropertySource(contextProperties);
  environment.addPropertySource(propertySource);

代码示例来源:origin: io.micronaut/micronaut-inject

environment.addPropertySource(contextProperties);
  environment.addPropertySource(propertySource);

相关文章