Add @DynamicPropertySource support in TestContext framework

This commit introduces a @DynamicPropertySource annotation that can be
used on methods in test classes that want to add properties to the
Environment with a dynamically supplied value.

This new feature can be used in conjunction with Testcontainers and
other frameworks that manage resources outside the lifecycle of a
test's ApplicationContext.

Closes gh-24540

Co-authored-by: Phillip Webb <pwebb@pivotal.io>
This commit is contained in:
Sam Brannen
2020-03-17 14:10:30 -07:00
parent 821a8eebdd
commit cf7daa36c8
11 changed files with 781 additions and 2 deletions

View File

@@ -12,4 +12,5 @@ org.springframework.test.context.TestExecutionListener = \
# Default ContextCustomizerFactory implementations for the Spring TestContext Framework
#
org.springframework.test.context.ContextCustomizerFactory = \
org.springframework.test.context.web.socket.MockServerContainerContextCustomizerFactory
org.springframework.test.context.web.socket.MockServerContainerContextCustomizerFactory,\
org.springframework.test.context.support.DynamicPropertiesContextCustomizerFactory