45
45
* @author Sam Brannen
46
46
* @since 5.2.5
47
47
* @see DynamicPropertiesContextCustomizerFactory
48
+ * @see DefaultDynamicPropertyRegistry
49
+ * @see DynamicPropertySourceBeanInitializer
48
50
*/
49
51
class DynamicPropertiesContextCustomizer implements ContextCustomizer {
50
52
@@ -59,20 +61,11 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer {
59
61
60
62
61
63
DynamicPropertiesContextCustomizer (Set <Method > methods ) {
62
- methods .forEach (this ::assertValid );
64
+ methods .forEach (DynamicPropertiesContextCustomizer ::assertValid );
63
65
this .methods = methods ;
64
66
}
65
67
66
68
67
- private void assertValid (Method method ) {
68
- Assert .state (Modifier .isStatic (method .getModifiers ()),
69
- () -> "@DynamicPropertySource method '" + method .getName () + "' must be static" );
70
- Class <?>[] types = method .getParameterTypes ();
71
- Assert .state (types .length == 1 && types [0 ] == DynamicPropertyRegistry .class ,
72
- () -> "@DynamicPropertySource method '" + method .getName () +
73
- "' must accept a single DynamicPropertyRegistry argument" );
74
- }
75
-
76
69
@ Override
77
70
public void customizeContext (ConfigurableApplicationContext context , MergedContextConfiguration mergedConfig ) {
78
71
ConfigurableEnvironment environment = context .getEnvironment ();
@@ -115,4 +108,14 @@ public int hashCode() {
115
108
return this .methods .hashCode ();
116
109
}
117
110
111
+
112
+ private static void assertValid (Method method ) {
113
+ Assert .state (Modifier .isStatic (method .getModifiers ()),
114
+ () -> "@DynamicPropertySource method '" + method .getName () + "' must be static" );
115
+ Class <?>[] types = method .getParameterTypes ();
116
+ Assert .state (types .length == 1 && types [0 ] == DynamicPropertyRegistry .class ,
117
+ () -> "@DynamicPropertySource method '" + method .getName () +
118
+ "' must accept a single DynamicPropertyRegistry argument" );
119
+ }
120
+
118
121
}
0 commit comments