File tree 1 file changed +10
-0
lines changed
buildSrc/src/main/java/org/springframework/boot/build/architecture
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 59
59
* @author Scott Frederick
60
60
* @author Ivan Malutin
61
61
* @author Phillip Webb
62
+ * @author Ngoc Nhan
62
63
*/
63
64
final class ArchitectureRules {
64
65
@@ -88,6 +89,7 @@ static List<ArchRule> standard() {
88
89
rules .add (noClassesShouldCallStringToLowerCaseWithoutLocale ());
89
90
rules .add (conditionalOnMissingBeanShouldNotSpecifyOnlyATypeThatIsTheSameAsMethodReturnType ());
90
91
rules .add (enumSourceShouldNotSpecifyOnlyATypeThatIsTheSameAsMethodParameterType ());
92
+ rules .add (allConfigurationPropertiesBindingBeanMethodsShouldBeStatic ());
91
93
return List .copyOf (rules );
92
94
}
93
95
@@ -230,6 +232,14 @@ private static void notSpecifyOnlyATypeThatIsTheSameAsTheMethodParameterType(Jav
230
232
}
231
233
}
232
234
235
+ private static ArchRule allConfigurationPropertiesBindingBeanMethodsShouldBeStatic () {
236
+ return methodsThatAreAnnotatedWith ("org.springframework.context.annotation.Bean" ).and ()
237
+ .areAnnotatedWith ("org.springframework.boot.context.properties.ConfigurationPropertiesBinding" )
238
+ .should ()
239
+ .beStatic ()
240
+ .allowEmptyShould (true );
241
+ }
242
+
233
243
private static boolean containsOnlySingleType (JavaType [] types , JavaType type ) {
234
244
return types .length == 1 && type .equals (types [0 ]);
235
245
}
You can’t perform that action at this time.
0 commit comments