closer to jdk-17 changes (#1074)
This commit is contained in:
@@ -24,7 +24,7 @@ import java.util.Optional;
|
||||
*
|
||||
* @author wind57
|
||||
*/
|
||||
public sealed abstract class NormalizedSource permits NamedSecretNormalizedSource,LabeledSecretNormalizedSource,NamedConfigMapNormalizedSource,LabeledConfigMapNormalizedSource {
|
||||
public sealed abstract class NormalizedSource permits NamedSecretNormalizedSource, LabeledSecretNormalizedSource, NamedConfigMapNormalizedSource, LabeledConfigMapNormalizedSource {
|
||||
|
||||
private final String namespace;
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ public final class ConfigReloadUtil {
|
||||
else if (sourceClass.isInstance(source)) {
|
||||
managedSources.add(sourceClass.cast(source));
|
||||
}
|
||||
else if (source instanceof BootstrapPropertySource) {
|
||||
PropertySource<?> propertySource = ((BootstrapPropertySource<?>) source).getDelegate();
|
||||
else if (source instanceof BootstrapPropertySource<?> bootstrapPropertySource) {
|
||||
PropertySource<?> propertySource = bootstrapPropertySource.getDelegate();
|
||||
if (sourceClass.isInstance(propertySource)) {
|
||||
sources.add(propertySource);
|
||||
}
|
||||
@@ -108,14 +108,16 @@ public final class ConfigReloadUtil {
|
||||
|
||||
List<MapPropertySource> result = new ArrayList<>();
|
||||
PropertySource<?> propertySource = propertySourceLocator.locate(environment);
|
||||
if (propertySource instanceof MapPropertySource) {
|
||||
result.add((MapPropertySource) propertySource);
|
||||
if (propertySource instanceof MapPropertySource mapPropertySource) {
|
||||
result.add(mapPropertySource);
|
||||
}
|
||||
else if (propertySource instanceof CompositePropertySource source) {
|
||||
|
||||
List<MapPropertySource> list = source.getPropertySources().stream()
|
||||
.filter(p -> p instanceof MapPropertySource).map(x -> (MapPropertySource) x).toList();
|
||||
result.addAll(list);
|
||||
source.getPropertySources().forEach(x -> {
|
||||
if (x instanceof MapPropertySource mapPropertySource) {
|
||||
result.add(mapPropertySource);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
LOG.debug(() -> "Found property source that cannot be handled: " + propertySource.getClass());
|
||||
|
||||
@@ -15,6 +15,5 @@
|
||||
<suppress files=".*ConfigurationWatcherApplication\.java" checks="HideUtilityClassConstructor"/>
|
||||
<suppress files=".*DiscoveryServerApplication\.java" checks="HideUtilityClassConstructor"/>
|
||||
<suppress files=".*KubernetesConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
|
||||
<suppress files=".*NormalizedSource\.java" checks="WhitespaceAfter" />
|
||||
<suppress files=".*Fabric8ConfigContext\.java" checks="WhitespaceAround" />
|
||||
</suppressions>
|
||||
|
||||
Reference in New Issue
Block a user