Merge branch '3.4.x'

Closes gh-45653
This commit is contained in:
Andy Wilkinson
2025-05-23 14:31:28 +01:00
5 changed files with 22 additions and 12 deletions

View File

@@ -64,6 +64,7 @@ import org.springframework.util.ResourceUtils;
* @author Scott Frederick
* @author Ivan Malutin
* @author Phillip Webb
* @author Ngoc Nhan
*/
final class ArchitectureRules {
@@ -96,6 +97,7 @@ final class ArchitectureRules {
rules.add(classLevelConfigurationPropertiesShouldNotSpecifyOnlyPrefixAttribute());
rules.add(methodLevelConfigurationPropertiesShouldNotSpecifyOnlyPrefixAttribute());
rules.add(conditionsShouldNotBePublic());
rules.add(allConfigurationPropertiesBindingBeanMethodsShouldBeStatic());
return List.copyOf(rules);
}
@@ -309,6 +311,14 @@ final class ArchitectureRules {
.allowEmptyShould(true);
}
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]);
}