本文整理了Java中io.micronaut.context.env.Environment.refreshAndDiff()
方法的一些代码示例,展示了Environment.refreshAndDiff()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.refreshAndDiff()
方法的具体详情如下:
包路径:io.micronaut.context.env.Environment
类名称:Environment
方法名:refreshAndDiff
[英]Refresh the environment from the list of PropertySource instances and return a diff of the changes.
[中]从PropertySource实例列表中刷新环境,并返回更改的差异。
代码示例来源:origin: io.micronaut/management
/**
* Refresh application state only if environment has changed (unless <code>force</code> is set to true).
*
* @param force {@link Nullable} body property to indicate whether to force all {@link io.micronaut.runtime.context.scope.Refreshable} beans to be refreshed
* @return array of change keys if applicable
*/
@Write
public String[] refresh(@Nullable Boolean force) {
if (force != null && force) {
eventPublisher.publishEvent(new RefreshEvent());
return new String[0];
} else {
Map<String, Object> changes = environment.refreshAndDiff();
if (!changes.isEmpty()) {
eventPublisher.publishEvent(new RefreshEvent(changes));
}
Set<String> keys = changes.keySet();
return keys.toArray(new String[keys.size()]);
}
}
}
代码示例来源:origin: io.micronaut/micronaut-management
/**
* Refresh application state only if environment has changed (unless <code>force</code> is set to true).
*
* @param force {@link Nullable} body property to indicate whether to force all {@link io.micronaut.runtime.context.scope.Refreshable} beans to be refreshed
* @return array of change keys if applicable
*/
@Write
public String[] refresh(@Nullable Boolean force) {
if (force != null && force) {
eventPublisher.publishEvent(new RefreshEvent());
return new String[0];
} else {
Map<String, Object> changes = environment.refreshAndDiff();
if (!changes.isEmpty()) {
eventPublisher.publishEvent(new RefreshEvent(changes));
}
Set<String> keys = changes.keySet();
return keys.toArray(new String[keys.size()]);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!