From 286ef610710366356bedb841271dfd805e9cbd0e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 8 Dec 2020 17:04:03 -0800 Subject: [PATCH] Narrow auto-configure checkstyle suppressions Closes gh-21015 --- .../boot/autoconfigure/AutoConfigureOrder.java | 3 +++ .../boot/autoconfigure/EnableAutoConfiguration.java | 4 ++++ .../cloud/CloudServiceConnectorsAutoConfiguration.java | 5 ++++- .../boot/autoconfigure/condition/ConditionMessage.java | 10 ++++++++++ .../servlet/DispatcherServletAutoConfiguration.java | 8 ++++---- .../web/servlet/WebMvcAutoConfiguration.java | 6 ++++++ src/checkstyle/checkstyle-suppressions.xml | 4 ++-- 7 files changed, 33 insertions(+), 7 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureOrder.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureOrder.java index ac9266cd90..2d90a2199b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureOrder.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureOrder.java @@ -48,6 +48,9 @@ import org.springframework.core.annotation.Order; @Documented public @interface AutoConfigureOrder { + /** + * The default order value. + */ int DEFAULT_ORDER = 0; /** diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java index e25c3ab13e..37c246a7a0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java @@ -83,6 +83,10 @@ import org.springframework.core.io.support.SpringFactoriesLoader; @Import(AutoConfigurationImportSelector.class) public @interface EnableAutoConfiguration { + /** + * Environment property that can be used to override when auto-configuration is + * enabled. + */ String ENABLED_OVERRIDE_PROPERTY = "spring.boot.enableautoconfiguration"; /** diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cloud/CloudServiceConnectorsAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cloud/CloudServiceConnectorsAutoConfiguration.java index e5f76ba184..a907f2362d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cloud/CloudServiceConnectorsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cloud/CloudServiceConnectorsAutoConfiguration.java @@ -54,7 +54,10 @@ import org.springframework.core.Ordered; @Import(CloudScanConfiguration.class) public class CloudServiceConnectorsAutoConfiguration { - // Cloud configuration needs to happen early (before data, mongo etc.) + /** + * The order for cloud configuration. Cloud configurations need to happen early (so + * that they run before data, mongo, etc.). + */ public static final int ORDER = Ordered.HIGHEST_PRECEDENCE + 20; private static final Log logger = LogFactory.getLog(CloudServiceConnectorsAutoConfiguration.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java index 18f2e07416..c4f5c36199 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java @@ -400,18 +400,28 @@ public final class ConditionMessage { */ public enum Style { + /** + * Render with normal styling. + */ NORMAL { + @Override protected Object applyToItem(Object item) { return item; } + }, + /** + * Render with the item surrounded by quotes. + */ QUOTE { + @Override protected String applyToItem(Object item) { return (item != null) ? "'" + item + "'" : null; } + }; public Collection applyTo(Collection items) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration.java index e84453ec75..c44cc710f0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration.java @@ -70,13 +70,13 @@ import org.springframework.web.servlet.DispatcherServlet; @AutoConfigureAfter(ServletWebServerFactoryAutoConfiguration.class) public class DispatcherServletAutoConfiguration { - /* - * The bean name for a DispatcherServlet that will be mapped to the root URL "/" + /** + * The bean name for a DispatcherServlet that will be mapped to the root URL "/". */ public static final String DEFAULT_DISPATCHER_SERVLET_BEAN_NAME = "dispatcherServlet"; - /* - * The bean name for a ServletRegistrationBean for the DispatcherServlet "/" + /** + * The bean name for a ServletRegistrationBean for the DispatcherServlet "/". */ public static final String DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME = "dispatcherServletRegistration"; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java index 1275b25e97..b1b079a28d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java @@ -141,8 +141,14 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver; ValidationAutoConfiguration.class }) public class WebMvcAutoConfiguration { + /** + * The default Spring MVC view prefix. + */ public static final String DEFAULT_PREFIX = ""; + /** + * The default Spring MVC view suffix. + */ public static final String DEFAULT_SUFFIX = ""; private static final String[] SERVLET_LOCATIONS = { "/" }; diff --git a/src/checkstyle/checkstyle-suppressions.xml b/src/checkstyle/checkstyle-suppressions.xml index 3d68bb86c7..1802f6b08f 100644 --- a/src/checkstyle/checkstyle-suppressions.xml +++ b/src/checkstyle/checkstyle-suppressions.xml @@ -15,8 +15,8 @@ - - + +