File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
buildSrc/src/main/java/org/springframework/boot/build/architecture Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 6464 * @author Scott Frederick
6565 * @author Ivan Malutin
6666 * @author Phillip Webb
67+ * @author Ngoc Nhan
6768 */
6869final class ArchitectureRules {
6970
@@ -96,6 +97,7 @@ static List<ArchRule> standard() {
9697 rules .add (classLevelConfigurationPropertiesShouldNotSpecifyOnlyPrefixAttribute ());
9798 rules .add (methodLevelConfigurationPropertiesShouldNotSpecifyOnlyPrefixAttribute ());
9899 rules .add (conditionsShouldNotBePublic ());
100+ rules .add (allConfigurationPropertiesBindingBeanMethodsShouldBeStatic ());
99101 return List .copyOf (rules );
100102 }
101103
@@ -309,6 +311,14 @@ private static ArchRule conditionsShouldNotBePublic() {
309311 .allowEmptyShould (true );
310312 }
311313
314+ private static ArchRule allConfigurationPropertiesBindingBeanMethodsShouldBeStatic () {
315+ return methodsThatAreAnnotatedWith ("org.springframework.context.annotation.Bean" ).and ()
316+ .areAnnotatedWith ("org.springframework.boot.context.properties.ConfigurationPropertiesBinding" )
317+ .should ()
318+ .beStatic ()
319+ .allowEmptyShould (true );
320+ }
321+
312322 private static boolean containsOnlySingleType (JavaType [] types , JavaType type ) {
313323 return types .length == 1 && type .equals (types [0 ]);
314324 }
You can’t perform that action at this time.
0 commit comments