Home / Class/ ConfigurationPropertiesTestBeanTests Class — spring-boot Architecture

ConfigurationPropertiesTestBeanTests Class — spring-boot Architecture

Architecture documentation for the ConfigurationPropertiesTestBeanTests class in ConfigurationPropertiesTestBeanTests.java from the spring-boot codebase.

Entity Profile

Source Code

core/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTestBeanTests.java lines 35–83

@SpringJUnitConfig
@TestPropertySource(properties = "immutable.property=test-property-source")
class ConfigurationPropertiesTestBeanTests {

	@TestBean
	@SuppressWarnings("NullAway.Init")
	private ImmutableProperties properties;

	@Autowired
	private SomeConfiguration someConfiguration;

	@Test
	void propertiesCanBeOverriddenUsingTestBean() {
		assertThat(this.properties.property).isEqualTo("test-bean");
		assertThat(this.someConfiguration.properties.property).isEqualTo("test-bean");
	}

	static ImmutableProperties properties() {
		return new ImmutableProperties("test-bean");
	}

	@Configuration(proxyBeanMethods = false)
	@EnableConfigurationProperties(ImmutableProperties.class)
	static class SomeConfiguration {

		private final ImmutableProperties properties;

		SomeConfiguration(ImmutableProperties properties) {
			this.properties = properties;
		}

	}

	@ConfigurationProperties("immutable")
	static class ImmutableProperties {

		private final String property;

		ImmutableProperties(String property) {
			this.property = property;
		}

		String getProperty() {
			return this.property;
		}

	}

}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free