You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2019/10/09 05:59:18 UTC
[dubbo] branch 2.7.4-release updated: [Refactor] Refactor the code
to remove alibaba/spring-context-support's implementation (#5147)
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch 2.7.4-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/2.7.4-release by this push:
new 5066775 [Refactor] Refactor the code to remove alibaba/spring-context-support's implementation (#5147)
5066775 is described below
commit 5066775e5893f4ee8764885f1d3233e363afefea
Author: Mercy Ma <me...@gmail.com>
AuthorDate: Wed Oct 9 13:59:12 2019 +0800
[Refactor] Refactor the code to remove alibaba/spring-context-support's implementation (#5147)
---
.../AbstractAnnotationConfigBeanBuilder.java | 8 +--
.../AnnotatedInterfaceConfigBeanBuilder.java | 8 +--
.../factory/annotation/ReferenceBeanBuilder.java | 5 +-
.../annotation/DubboConfigBindingRegistrar.java | 8 +--
.../properties/DefaultDubboConfigBinder.java | 4 +-
.../dubbo/config/spring/util/BeanFactoryUtils.java | 33 ++++--------
.../config/spring/util/PropertySourcesUtils.java | 60 ++++++++++++----------
.../config/spring/util/BeanFactoryUtilsTest.java | 8 +--
.../spring/util/PropertySourcesUtilsTest.java | 10 ++--
9 files changed, 69 insertions(+), 75 deletions(-)
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AbstractAnnotationConfigBeanBuilder.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AbstractAnnotationConfigBeanBuilder.java
index 25da5d9..670d568 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AbstractAnnotationConfigBeanBuilder.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AbstractAnnotationConfigBeanBuilder.java
@@ -31,7 +31,7 @@ import java.lang.annotation.Annotation;
import java.util.List;
import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.getBeans;
-import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.getOptionalBean;
+import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.getNullableBean;
/**
* Abstract Configurable {@link Annotation} Bean Builder
@@ -132,7 +132,7 @@ abstract class AbstractAnnotationConfigBeanBuilder<A extends Annotation, B exten
String monitorBeanName = resolveMonitorConfigBeanName(annotation);
- MonitorConfig monitorConfig = getOptionalBean(applicationContext, monitorBeanName, MonitorConfig.class);
+ MonitorConfig monitorConfig = getNullableBean(applicationContext, monitorBeanName, MonitorConfig.class);
bean.setMonitor(monitorConfig);
@@ -143,7 +143,7 @@ abstract class AbstractAnnotationConfigBeanBuilder<A extends Annotation, B exten
String applicationConfigBeanName = resolveApplicationConfigBeanName(annotation);
ApplicationConfig applicationConfig =
- getOptionalBean(applicationContext, applicationConfigBeanName, ApplicationConfig.class);
+ getNullableBean(applicationContext, applicationConfigBeanName, ApplicationConfig.class);
bean.setApplication(applicationConfig);
@@ -154,7 +154,7 @@ abstract class AbstractAnnotationConfigBeanBuilder<A extends Annotation, B exten
String moduleConfigBeanName = resolveModuleConfigBeanName(annotation);
ModuleConfig moduleConfig =
- getOptionalBean(applicationContext, moduleConfigBeanName, ModuleConfig.class);
+ getNullableBean(applicationContext, moduleConfigBeanName, ModuleConfig.class);
bean.setModule(moduleConfig);
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AnnotatedInterfaceConfigBeanBuilder.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AnnotatedInterfaceConfigBeanBuilder.java
index 32a37ba..97b6655 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AnnotatedInterfaceConfigBeanBuilder.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AnnotatedInterfaceConfigBeanBuilder.java
@@ -32,7 +32,7 @@ import java.lang.annotation.Annotation;
import java.util.List;
import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.getBeans;
-import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.getOptionalBean;
+import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.getNullableBean;
/**
* An Abstract Builder to build {@link AbstractInterfaceConfig Interface Config} Bean that annotated
@@ -133,7 +133,7 @@ public abstract class AnnotatedInterfaceConfigBeanBuilder<C extends AbstractInte
String monitorBeanName = resolveMonitorConfigBeanName(attributes);
- MonitorConfig monitorConfig = getOptionalBean(applicationContext, monitorBeanName, MonitorConfig.class);
+ MonitorConfig monitorConfig = getNullableBean(applicationContext, monitorBeanName, MonitorConfig.class);
configBean.setMonitor(monitorConfig);
@@ -144,7 +144,7 @@ public abstract class AnnotatedInterfaceConfigBeanBuilder<C extends AbstractInte
String applicationConfigBeanName = resolveApplicationConfigBeanName(attributes);
ApplicationConfig applicationConfig =
- getOptionalBean(applicationContext, applicationConfigBeanName, ApplicationConfig.class);
+ getNullableBean(applicationContext, applicationConfigBeanName, ApplicationConfig.class);
configBean.setApplication(applicationConfig);
@@ -155,7 +155,7 @@ public abstract class AnnotatedInterfaceConfigBeanBuilder<C extends AbstractInte
String moduleConfigBeanName = resolveModuleConfigBeanName(attributes);
ModuleConfig moduleConfig =
- getOptionalBean(applicationContext, moduleConfigBeanName, ModuleConfig.class);
+ getNullableBean(applicationContext, moduleConfigBeanName, ModuleConfig.class);
configBean.setModule(moduleConfig);
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceBeanBuilder.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceBeanBuilder.java
index ae620f4..55cb646 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceBeanBuilder.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceBeanBuilder.java
@@ -22,6 +22,7 @@ import org.apache.dubbo.config.MethodConfig;
import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.config.spring.ReferenceBean;
+
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.AnnotationAttributes;
@@ -36,7 +37,7 @@ import java.util.Map;
import static org.apache.dubbo.config.spring.util.AnnotationUtils.getAttribute;
import static org.apache.dubbo.config.spring.util.AnnotationUtils.getAttributes;
import static org.apache.dubbo.config.spring.util.AnnotationUtils.resolveServiceInterfaceClass;
-import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.getOptionalBean;
+import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.getNullableBean;
import static org.apache.dubbo.config.spring.util.ObjectUtils.of;
import static org.springframework.core.annotation.AnnotationAttributes.fromMap;
import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
@@ -80,7 +81,7 @@ class ReferenceBeanBuilder extends AnnotatedInterfaceConfigBeanBuilder<Reference
String consumerBeanName = getAttribute(attributes, "consumer");
- ConsumerConfig consumerConfig = getOptionalBean(applicationContext, consumerBeanName, ConsumerConfig.class);
+ ConsumerConfig consumerConfig = getNullableBean(applicationContext, consumerBeanName, ConsumerConfig.class);
referenceBean.setConsumer(consumerConfig);
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigBindingRegistrar.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigBindingRegistrar.java
index f604a3f..80c924a 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigBindingRegistrar.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigBindingRegistrar.java
@@ -44,8 +44,8 @@ import java.util.Set;
import static org.apache.dubbo.config.spring.context.config.NamePropertyDefaultValueDubboConfigBeanCustomizer.BEAN_NAME;
import static org.apache.dubbo.config.spring.util.BeanRegistrar.registerInfrastructureBean;
-import static org.apache.dubbo.config.spring.util.PropertySourcesUtils.getSubProperties;
-import static org.apache.dubbo.config.spring.util.PropertySourcesUtils.normalizePrefix;
+import static org.apache.dubbo.config.spring.util.PropertySourcesUtils.buildPrefix;
+import static org.apache.dubbo.config.spring.util.PropertySourcesUtils.getPrefixedProperties;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;
import static org.springframework.beans.factory.support.BeanDefinitionReaderUtils.registerWithGeneratedName;
@@ -89,7 +89,7 @@ public class DubboConfigBindingRegistrar implements ImportBeanDefinitionRegistra
boolean multiple,
BeanDefinitionRegistry registry) {
- Map<String, Object> properties = getSubProperties(environment.getPropertySources(), prefix);
+ Map<String, Object> properties = getPrefixedProperties(environment.getPropertySources(), prefix);
if (CollectionUtils.isEmpty(properties)) {
if (log.isDebugEnabled()) {
@@ -137,7 +137,7 @@ public class DubboConfigBindingRegistrar implements ImportBeanDefinitionRegistra
BeanDefinitionBuilder builder = rootBeanDefinition(processorClass);
- String actualPrefix = multiple ? normalizePrefix(prefix) + beanName : prefix;
+ String actualPrefix = multiple ? buildPrefix(prefix) + beanName : prefix;
builder.addConstructorArgValue(actualPrefix).addConstructorArgValue(beanName);
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/properties/DefaultDubboConfigBinder.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/properties/DefaultDubboConfigBinder.java
index ca10d3e..c989a88 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/properties/DefaultDubboConfigBinder.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/properties/DefaultDubboConfigBinder.java
@@ -23,7 +23,7 @@ import org.springframework.validation.DataBinder;
import java.util.Map;
-import static org.apache.dubbo.config.spring.util.PropertySourcesUtils.getSubProperties;
+import static org.apache.dubbo.config.spring.util.PropertySourcesUtils.getPrefixedProperties;
/**
* Default {@link DubboConfigBinder} implementation based on Spring {@link DataBinder}
@@ -37,7 +37,7 @@ public class DefaultDubboConfigBinder extends AbstractDubboConfigBinder {
dataBinder.setIgnoreInvalidFields(isIgnoreInvalidFields());
dataBinder.setIgnoreUnknownFields(isIgnoreUnknownFields());
// Get properties under specified prefix from PropertySources
- Map<String, Object> properties = getSubProperties(getPropertySources(), prefix);
+ Map<String, Object> properties = getPrefixedProperties(getPropertySources(), prefix);
// Convert Map to MutablePropertyValues
MutablePropertyValues propertyValues = new MutablePropertyValues(properties);
// Bind
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/BeanFactoryUtils.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/BeanFactoryUtils.java
index 558986e..76f7379 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/BeanFactoryUtils.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/BeanFactoryUtils.java
@@ -27,12 +27,8 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
import static java.util.Collections.emptyList;
-import static org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors;
-import static org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors;
-import static org.springframework.util.ObjectUtils.containsElement;
import static org.springframework.util.ObjectUtils.isEmpty;
/**
@@ -70,27 +66,22 @@ public class BeanFactoryUtils {
}
/**
- * Get optional Bean
+ * Get nullable Bean
*
* @param beanFactory {@link ListableBeanFactory}
* @param beanName the name of Bean
* @param beanType the {@link Class type} of Bean
* @param <T> the {@link Class type} of Bean
* @return A bean if present , or <code>null</code>
- * @since 2.6.6
*/
- public static <T> T getOptionalBean(ListableBeanFactory beanFactory, String beanName, Class<T> beanType) {
-
- String[] allBeanNames = beanNamesForTypeIncludingAncestors(beanFactory, beanType);
-
- if (!containsElement(allBeanNames, beanName)) {
- return null;
+ public static <T> T getNullableBean(ListableBeanFactory beanFactory, String beanName, Class<T> beanType) {
+ T bean = null;
+ try {
+ bean = beanFactory.getBean(beanName, beanType);
+ } catch (Throwable ignored) {
+ // Any exception will be ignored to handle
}
-
- Map<String, T> beansOfType = beansOfTypeIncludingAncestors(beanFactory, beanType);
-
- return beansOfType.get(beanName);
-
+ return bean;
}
@@ -102,7 +93,6 @@ public class BeanFactoryUtils {
* @param beanType the {@link Class type} of Bean
* @param <T> the {@link Class type} of Bean
* @return the read-only and non-null {@link List} of Bean names
- * @since 2.6.6
*/
public static <T> List<T> getBeans(ListableBeanFactory beanFactory, String[] beanNames, Class<T> beanType) {
@@ -110,13 +100,12 @@ public class BeanFactoryUtils {
return emptyList();
}
- String[] allBeanNames = beanNamesForTypeIncludingAncestors(beanFactory, beanType);
-
List<T> beans = new ArrayList<T>(beanNames.length);
for (String beanName : beanNames) {
- if (containsElement(allBeanNames, beanName)) {
- beans.add(beanFactory.getBean(beanName, beanType));
+ T bean = getNullableBean(beanFactory, beanName, beanType);
+ if (bean != null) {
+ beans.add(bean);
}
}
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/PropertySourcesUtils.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/PropertySourcesUtils.java
index d9c3b66..007f17f 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/PropertySourcesUtils.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/PropertySourcesUtils.java
@@ -16,18 +16,20 @@
*/
package org.apache.dubbo.config.spring.util;
-import org.springframework.core.env.AbstractEnvironment;
-import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.MutablePropertySources;
+import org.springframework.core.env.PropertyResolver;
import org.springframework.core.env.PropertySource;
import org.springframework.core.env.PropertySources;
+import org.springframework.core.env.PropertySourcesPropertyResolver;
-import java.util.Collections;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
+import static java.util.Collections.unmodifiableMap;
+
/**
* {@link PropertySources} Utilities
@@ -38,74 +40,76 @@ import java.util.Properties;
public abstract class PropertySourcesUtils {
/**
- * Get Sub {@link Properties}
+ * Get prefixed {@link Properties}
*
* @param propertySources {@link PropertySource} Iterable
* @param prefix the prefix of property name
* @return Map
* @see Properties
*/
- public static Map<String, Object> getSubProperties(Iterable<PropertySource<?>> propertySources, String prefix) {
-
- // Non-Extension AbstractEnvironment
- AbstractEnvironment environment = new AbstractEnvironment() {
- };
+ public static Map<String, Object> getPrefixedProperties(Iterable<PropertySource<?>> propertySources, String prefix) {
- MutablePropertySources mutablePropertySources = environment.getPropertySources();
+ MutablePropertySources mutablePropertySources = new MutablePropertySources();
for (PropertySource<?> source : propertySources) {
mutablePropertySources.addLast(source);
}
- return getSubProperties(environment, prefix);
+ return getPrefixedProperties(mutablePropertySources, prefix);
}
/**
- * Get Sub {@link Properties}
+ * Get prefixed {@link Properties}
*
- * @param environment {@link ConfigurableEnvironment}
- * @param prefix the prefix of property name
+ * @param propertySources {@link PropertySources}
+ * @param prefix the prefix of property name
* @return Map
* @see Properties
*/
- public static Map<String, Object> getSubProperties(ConfigurableEnvironment environment, String prefix) {
+ public static Map<String, Object> getPrefixedProperties(PropertySources propertySources, String prefix) {
- Map<String, Object> subProperties = new LinkedHashMap<>();
+ PropertyResolver propertyResolver = new PropertySourcesPropertyResolver(propertySources);
- MutablePropertySources propertySources = environment.getPropertySources();
+ Map<String, Object> prefixedProperties = new LinkedHashMap<>();
- String normalizedPrefix = normalizePrefix(prefix);
+ String normalizedPrefix = buildPrefix(prefix);
- for (PropertySource<?> source : propertySources) {
+ Iterator<PropertySource<?>> iterator = propertySources.iterator();
+
+ while (iterator.hasNext()) {
+ PropertySource<?> source = iterator.next();
if (source instanceof EnumerablePropertySource) {
for (String name : ((EnumerablePropertySource<?>) source).getPropertyNames()) {
- if (!subProperties.containsKey(name) && name.startsWith(normalizedPrefix)) {
+ if (!prefixedProperties.containsKey(name) && name.startsWith(normalizedPrefix)) {
String subName = name.substring(normalizedPrefix.length());
- if (!subProperties.containsKey(subName)) { // take first one
+ if (!prefixedProperties.containsKey(subName)) { // take first one
Object value = source.getProperty(name);
if (value instanceof String) {
// Resolve placeholder
- value = environment.resolvePlaceholders((String) value);
+ value = propertyResolver.resolvePlaceholders((String) value);
}
- subProperties.put(subName, value);
+ prefixedProperties.put(subName, value);
}
}
}
}
}
- return Collections.unmodifiableMap(subProperties);
-
+ return unmodifiableMap(prefixedProperties);
}
/**
- * Normalize the prefix
+ * Build the prefix
*
* @param prefix the prefix
* @return the prefix
*/
- public static String normalizePrefix(String prefix) {
- return prefix.endsWith(".") ? prefix : prefix + ".";
+ public static String buildPrefix(String prefix) {
+ if (prefix.endsWith(".")) {
+ return prefix;
+ } else {
+ return prefix + ".";
+ }
}
}
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/BeanFactoryUtilsTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/BeanFactoryUtilsTest.java
index a445ae9..f265f28 100644
--- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/BeanFactoryUtilsTest.java
+++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/BeanFactoryUtilsTest.java
@@ -39,13 +39,13 @@ public class BeanFactoryUtilsTest {
}
@Test
- public void testGetOptionalBean() {
+ public void testGetNullableBean() {
applicationContext.register(TestBean.class);
applicationContext.refresh();
- TestBean testBean = BeanFactoryUtils.getOptionalBean(applicationContext, "testBean", TestBean.class);
+ TestBean testBean = BeanFactoryUtils.getNullableBean(applicationContext, "testBean", TestBean.class);
Assertions.assertNotNull(testBean);
@@ -54,11 +54,11 @@ public class BeanFactoryUtilsTest {
}
@Test
- public void testGetOptionalBeanIfAbsent() {
+ public void testGetNullableBeanIfAbsent() {
applicationContext.refresh();
- TestBean testBean = BeanFactoryUtils.getOptionalBean(applicationContext, "testBean", TestBean.class);
+ TestBean testBean = BeanFactoryUtils.getNullableBean(applicationContext, "testBean", TestBean.class);
Assertions.assertNull(testBean);
}
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/PropertySourcesUtilsTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/PropertySourcesUtilsTest.java
index 9e8c29f..01ce07d 100644
--- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/PropertySourcesUtilsTest.java
+++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/PropertySourcesUtilsTest.java
@@ -34,7 +34,7 @@ import java.util.Map;
public class PropertySourcesUtilsTest {
@Test
- public void testGetSubProperties() {
+ public void testGetPrefixedProperties() {
MutablePropertySources propertySources = new MutablePropertySources();
@@ -47,7 +47,7 @@ public class PropertySourcesUtilsTest {
propertySources.addLast(propertySource);
propertySources.addLast(propertySource2);
- Map<String, Object> result = PropertySourcesUtils.getSubProperties(propertySources, "user");
+ Map<String, Object> result = PropertySourcesUtils.getPrefixedProperties(propertySources, "user");
Assertions.assertEquals(Collections.emptyMap(), result);
@@ -62,14 +62,14 @@ public class PropertySourcesUtilsTest {
expected.put("name", "Mercy");
expected.put("age", "31");
- result = PropertySourcesUtils.getSubProperties(propertySources, "user");
+ result = PropertySourcesUtils.getPrefixedProperties(propertySources, "user");
Assertions.assertEquals(expected, result);
- result = PropertySourcesUtils.getSubProperties(propertySources, "");
+ result = PropertySourcesUtils.getPrefixedProperties(propertySources, "");
Assertions.assertEquals(Collections.emptyMap(), result);
- result = PropertySourcesUtils.getSubProperties(propertySources, "no-exists");
+ result = PropertySourcesUtils.getPrefixedProperties(propertySources, "no-exists");
Assertions.assertEquals(Collections.emptyMap(), result);