Merge branch '3.3.x' into 3.4.x
Closes gh-45651
This commit is contained in:
@@ -59,6 +59,7 @@ import org.springframework.util.ResourceUtils;
|
||||
* @author Scott Frederick
|
||||
* @author Ivan Malutin
|
||||
* @author Phillip Webb
|
||||
* @author Ngoc Nhan
|
||||
*/
|
||||
final class ArchitectureRules {
|
||||
|
||||
@@ -88,6 +89,7 @@ final class ArchitectureRules {
|
||||
rules.add(noClassesShouldCallStringToLowerCaseWithoutLocale());
|
||||
rules.add(conditionalOnMissingBeanShouldNotSpecifyOnlyATypeThatIsTheSameAsMethodReturnType());
|
||||
rules.add(enumSourceShouldNotSpecifyOnlyATypeThatIsTheSameAsMethodParameterType());
|
||||
rules.add(allConfigurationPropertiesBindingBeanMethodsShouldBeStatic());
|
||||
return List.copyOf(rules);
|
||||
}
|
||||
|
||||
@@ -244,6 +246,14 @@ final class ArchitectureRules {
|
||||
}
|
||||
}
|
||||
|
||||
private static ArchRule allConfigurationPropertiesBindingBeanMethodsShouldBeStatic() {
|
||||
return methodsThatAreAnnotatedWith("org.springframework.context.annotation.Bean").and()
|
||||
.areAnnotatedWith("org.springframework.boot.context.properties.ConfigurationPropertiesBinding")
|
||||
.should()
|
||||
.beStatic()
|
||||
.allowEmptyShould(true);
|
||||
}
|
||||
|
||||
private static boolean containsOnlySingleType(JavaType[] types, JavaType type) {
|
||||
return types.length == 1 && type.equals(types[0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user