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 5959 * @author Scott Frederick
6060 * @author Ivan Malutin
6161 * @author Phillip Webb
62+ * @author Ngoc Nhan
6263 */
6364final class ArchitectureRules {
6465
@@ -88,6 +89,7 @@ static List<ArchRule> standard() {
8889 rules .add (noClassesShouldCallStringToLowerCaseWithoutLocale ());
8990 rules .add (conditionalOnMissingBeanShouldNotSpecifyOnlyATypeThatIsTheSameAsMethodReturnType ());
9091 rules .add (enumSourceShouldNotSpecifyOnlyATypeThatIsTheSameAsMethodParameterType ());
92+ rules .add (allConfigurationPropertiesBindingBeanMethodsShouldBeStatic ());
9193 return List .copyOf (rules );
9294 }
9395
@@ -230,6 +232,14 @@ private static void notSpecifyOnlyATypeThatIsTheSameAsTheMethodParameterType(Jav
230232 }
231233 }
232234
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+
233243 private static boolean containsOnlySingleType (JavaType [] types , JavaType type ) {
234244 return types .length == 1 && type .equals (types [0 ]);
235245 }
You can’t perform that action at this time.
0 commit comments