@@ -1018,28 +1018,40 @@ private Converter<?> getConverter(SmallRyeConfig config, Field field, ConverterT
1018
1018
*/
1019
1019
private Set <String > getAllProperties (final Set <String > registeredRoots ) {
1020
1020
Set <String > properties = new HashSet <>();
1021
+
1022
+ // Get all properties, including the ones generated by interceptors, but these do not include profiles
1021
1023
for (String property : config .getPropertyNames ()) {
1022
1024
properties .add (property );
1023
1025
}
1024
1026
1027
+ Set <String > propertiesToRemove = new HashSet <>();
1028
+ Set <String > propertiesToAdd = new HashSet <>();
1029
+
1030
+ // Get properties per source to collect profiled properties and exclude properties that are build related
1025
1031
for (ConfigSource configSource : config .getConfigSources ()) {
1026
1032
if (configSource instanceof SysPropConfigSource || configSource instanceof EnvConfigSource
1027
1033
|| "PropertiesConfigSource[source=Build system]" .equals (configSource .getName ())) {
1028
1034
for (String property : configSource .getPropertyNames ()) {
1029
1035
NameIterator ni = new NameIterator (property );
1030
1036
if (ni .hasNext () && PropertiesUtil .isPropertyInRoot (registeredRoots , ni )) {
1031
- properties .add (property );
1037
+ propertiesToAdd .add (property );
1032
1038
} else {
1033
- properties . remove (property );
1039
+ propertiesToRemove . add (property );
1034
1040
if (configSource instanceof EnvConfigSource ) {
1035
- properties . remove (StringUtil .toLowerCaseAndDotted (property ));
1041
+ propertiesToRemove . add (StringUtil .toLowerCaseAndDotted (property ));
1036
1042
}
1037
1043
}
1038
1044
}
1039
1045
} else {
1040
- properties .addAll (configSource .getPropertyNames ());
1046
+ propertiesToAdd .addAll (configSource .getPropertyNames ());
1041
1047
}
1042
1048
}
1049
+
1050
+ // A property may exist in an excluded source and an include source. We don't have a way to know, so we
1051
+ // just remove the excluded ones and add the ones to be included, so the property is back there again
1052
+ properties .removeAll (propertiesToRemove );
1053
+ properties .addAll (propertiesToAdd );
1054
+
1043
1055
return properties ;
1044
1056
}
1045
1057
0 commit comments