Search in sources :

Example 6 with ContextConfigurationProperties

use of org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ContextConfigurationProperties in project spring-boot by spring-projects.

the class ConfigurationPropertiesReportEndpointFilteringTests method filterByPrefixNoMatches.

@Test
void filterByPrefixNoMatches() {
    ApplicationContextRunner contextRunner = new ApplicationContextRunner().withUserConfiguration(Config.class).withPropertyValues("foo.primary.name:foo1", "foo.secondary.name:foo2", "only.bar.name:solo1");
    contextRunner.run((context) -> {
        ConfigurationPropertiesReportEndpoint endpoint = context.getBean(ConfigurationPropertiesReportEndpoint.class);
        ApplicationConfigurationProperties applicationProperties = endpoint.configurationPropertiesWithPrefix("foo.third");
        assertThat(applicationProperties.getContexts()).containsOnlyKeys(context.getId());
        ContextConfigurationProperties contextProperties = applicationProperties.getContexts().get(context.getId());
        assertThat(contextProperties.getBeans()).isEmpty();
    });
}
Also used : ContextConfigurationProperties(org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ContextConfigurationProperties) ApplicationConfigurationProperties(org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ApplicationConfigurationProperties) ApplicationContextRunner(org.springframework.boot.test.context.runner.ApplicationContextRunner) Test(org.junit.jupiter.api.Test)

Aggregations

ContextConfigurationProperties (org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ContextConfigurationProperties)6 Test (org.junit.jupiter.api.Test)5 ApplicationConfigurationProperties (org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ApplicationConfigurationProperties)5 ApplicationContextRunner (org.springframework.boot.test.context.runner.ApplicationContextRunner)5 ConfigurationPropertiesBeanDescriptor (org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ConfigurationPropertiesBeanDescriptor)2 Map (java.util.Map)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)1 ConfigurationPropertiesReportEndpoint (org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint)1 StaticApplicationContext (org.springframework.context.support.StaticApplicationContext)1