diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeBom.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeBom.java index d1b400385b..e4db7fee9e 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeBom.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeBom.java @@ -58,7 +58,7 @@ import org.springframework.util.StringUtils; */ public class UpgradeBom extends DefaultTask { - private Set repositoryUrls; + private final Set repositoryUrls; private final BomExtension bom; diff --git a/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/PrepareMavenBinaries.java b/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/PrepareMavenBinaries.java index a94da2e4fd..351470c7da 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/PrepareMavenBinaries.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/PrepareMavenBinaries.java @@ -35,7 +35,7 @@ import org.gradle.api.tasks.TaskAction; */ public class PrepareMavenBinaries extends DefaultTask { - private Set versions = new LinkedHashSet<>(); + private final Set versions = new LinkedHashSet<>(); private File outputDir; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointProperties.java index 1efbb193ac..e7a0ee84f4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointProperties.java @@ -42,7 +42,7 @@ public class ConfigurationPropertiesReportEndpointProperties { * Roles used to determine whether a user is authorized to be shown unsanitized * values. When empty, all authenticated users are authorized. */ - private Set roles = new HashSet<>(); + private final Set roles = new HashSet<>(); public Show getShowValues() { return this.showValues; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointProperties.java index f2d4074044..673bfd9ef3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointProperties.java @@ -41,7 +41,7 @@ public class EnvironmentEndpointProperties { * Roles used to determine whether a user is authorized to be shown unsanitized * values. When empty, all authenticated users are authorized. */ - private Set roles = new HashSet<>(); + private final Set roles = new HashSet<>(); public Show getShowValues() { return this.showValues; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/quartz/QuartzEndpointProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/quartz/QuartzEndpointProperties.java index a55b49cbea..8f8fcdfddf 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/quartz/QuartzEndpointProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/quartz/QuartzEndpointProperties.java @@ -41,7 +41,7 @@ public class QuartzEndpointProperties { * Roles used to determine whether a user is authorized to be shown unsanitized job or * trigger values. When empty, all authenticated users are authorized. */ - private Set roles = new HashSet<>(); + private final Set roles = new HashSet<>(); public Show getShowValues() { return this.showValues; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesAutoConfigurationTests.java index 7e422cc579..6f596d12f8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesAutoConfigurationTests.java @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class AvailabilityProbesAutoConfigurationTests { - private ApplicationContextRunner contextRunner = new ApplicationContextRunner() + private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(ApplicationAvailabilityAutoConfiguration.class, AvailabilityHealthContributorAutoConfiguration.class, AvailabilityProbesAutoConfiguration.class)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesHealthEndpointGroupTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesHealthEndpointGroupTests.java index 61d36f9d66..368deea091 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesHealthEndpointGroupTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesHealthEndpointGroupTests.java @@ -32,7 +32,8 @@ import static org.mockito.Mockito.mock; */ class AvailabilityProbesHealthEndpointGroupTests { - private AvailabilityProbesHealthEndpointGroup group = new AvailabilityProbesHealthEndpointGroup(null, "a", "b"); + private final AvailabilityProbesHealthEndpointGroup group = new AvailabilityProbesHealthEndpointGroup(null, "a", + "b"); @Test void isMemberWhenMemberReturnsTrue() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesHealthEndpointGroupsPostProcessorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesHealthEndpointGroupsPostProcessorTests.java index 8c53e4a0f0..39b245d4b4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesHealthEndpointGroupsPostProcessorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityProbesHealthEndpointGroupsPostProcessorTests.java @@ -37,7 +37,7 @@ import static org.mockito.Mockito.mock; */ class AvailabilityProbesHealthEndpointGroupsPostProcessorTests { - private AvailabilityProbesHealthEndpointGroupsPostProcessor postProcessor = new AvailabilityProbesHealthEndpointGroupsPostProcessor( + private final AvailabilityProbesHealthEndpointGroupsPostProcessor postProcessor = new AvailabilityProbesHealthEndpointGroupsPostProcessor( new MockEnvironment()); @Test diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilterTests.java index 0c07bb1800..a043fdf1b4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilterTests.java @@ -31,7 +31,7 @@ import static org.mockito.Mockito.mock; */ class CloudFoundryEndpointFilterTests { - private CloudFoundryEndpointFilter filter = new CloudFoundryEndpointFilter(); + private final CloudFoundryEndpointFilter filter = new CloudFoundryEndpointFilter(); @Test void matchIfDiscovererCloudFoundryShouldReturnFalse() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointIntegrationTests.java index 7b1d3ad033..3fb1df57fe 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointIntegrationTests.java @@ -71,9 +71,9 @@ import static org.mockito.Mockito.mock; */ class CloudFoundryWebFluxEndpointIntegrationTests { - private static ReactiveTokenValidator tokenValidator = mock(ReactiveTokenValidator.class); + private static final ReactiveTokenValidator tokenValidator = mock(ReactiveTokenValidator.class); - private static ReactiveCloudFoundrySecurityService securityService = mock( + private static final ReactiveCloudFoundrySecurityService securityService = mock( ReactiveCloudFoundrySecurityService.class); private final ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner( diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryMvcWebEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryMvcWebEndpointIntegrationTests.java index a7affad6a0..0862b91be7 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryMvcWebEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryMvcWebEndpointIntegrationTests.java @@ -66,9 +66,9 @@ import static org.mockito.Mockito.mock; */ class CloudFoundryMvcWebEndpointIntegrationTests { - private static TokenValidator tokenValidator = mock(TokenValidator.class); + private static final TokenValidator tokenValidator = mock(TokenValidator.class); - private static CloudFoundrySecurityService securityService = mock(CloudFoundrySecurityService.class); + private static final CloudFoundrySecurityService securityService = mock(CloudFoundrySecurityService.class); @Test void operationWithSecurityInterceptorForbidden() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/jackson/JacksonEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/jackson/JacksonEndpointAutoConfigurationTests.java index f4b1fa5ddc..3288b28d46 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/jackson/JacksonEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/jackson/JacksonEndpointAutoConfigurationTests.java @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class JacksonEndpointAutoConfigurationTests { - private ApplicationContextRunner runner = new ApplicationContextRunner() + private final ApplicationContextRunner runner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(JacksonEndpointAutoConfiguration.class)); @Test diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryPostProcessorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryPostProcessorTests.java index a6ee9c57a8..54d3bbcc41 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryPostProcessorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryPostProcessorTests.java @@ -50,11 +50,11 @@ class MeterRegistryPostProcessorTests { private final MetricsProperties properties = new MetricsProperties(); - private List> customizers = new ArrayList<>(); + private final List> customizers = new ArrayList<>(); - private List filters = new ArrayList<>(); + private final List filters = new ArrayList<>(); - private List binders = new ArrayList<>(); + private final List binders = new ArrayList<>(); @Mock private MeterRegistryCustomizer mockCustomizer; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/data/MetricsRepositoryMethodInvocationListenerBeanPostProcessorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/data/MetricsRepositoryMethodInvocationListenerBeanPostProcessorTests.java index 2077bfeefa..8af724a05d 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/data/MetricsRepositoryMethodInvocationListenerBeanPostProcessorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/data/MetricsRepositoryMethodInvocationListenerBeanPostProcessorTests.java @@ -36,9 +36,10 @@ import static org.mockito.Mockito.mock; */ class MetricsRepositoryMethodInvocationListenerBeanPostProcessorTests { - private MetricsRepositoryMethodInvocationListener listener = mock(MetricsRepositoryMethodInvocationListener.class); + private final MetricsRepositoryMethodInvocationListener listener = mock( + MetricsRepositoryMethodInvocationListener.class); - private MetricsRepositoryMethodInvocationListenerBeanPostProcessor postProcessor = new MetricsRepositoryMethodInvocationListenerBeanPostProcessor( + private final MetricsRepositoryMethodInvocationListenerBeanPostProcessor postProcessor = new MetricsRepositoryMethodInvocationListenerBeanPostProcessor( SingletonSupplier.of(this.listener)); @Test diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientHttpObservationConventionAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientHttpObservationConventionAdapterTests.java index 04e9f42625..814e71a4c7 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientHttpObservationConventionAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientHttpObservationConventionAdapterTests.java @@ -44,12 +44,12 @@ class ClientHttpObservationConventionAdapterTests { private static final String TEST_METRIC_NAME = "test.metric.name"; - private ClientHttpObservationConventionAdapter convention = new ClientHttpObservationConventionAdapter( + private final ClientHttpObservationConventionAdapter convention = new ClientHttpObservationConventionAdapter( TEST_METRIC_NAME, new DefaultRestTemplateExchangeTagsProvider()); - private ClientHttpRequest request = new MockClientHttpRequest(HttpMethod.GET, URI.create("/resource/test")); + private final ClientHttpRequest request = new MockClientHttpRequest(HttpMethod.GET, URI.create("/resource/test")); - private ClientHttpResponse response = new MockClientHttpResponse("foo".getBytes(), HttpStatus.OK); + private final ClientHttpResponse response = new MockClientHttpResponse("foo".getBytes(), HttpStatus.OK); private ClientRequestObservationContext context; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientObservationConventionAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientObservationConventionAdapterTests.java index 6df42c0093..ea6929744c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientObservationConventionAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientObservationConventionAdapterTests.java @@ -43,13 +43,14 @@ class ClientObservationConventionAdapterTests { private static final String TEST_METRIC_NAME = "test.metric.name"; - private ClientObservationConventionAdapter convention = new ClientObservationConventionAdapter(TEST_METRIC_NAME, - new DefaultWebClientExchangeTagsProvider()); + private final ClientObservationConventionAdapter convention = new ClientObservationConventionAdapter( + TEST_METRIC_NAME, new DefaultWebClientExchangeTagsProvider()); - private ClientRequest.Builder requestBuilder = ClientRequest.create(HttpMethod.GET, URI.create("/resource/test")) + private final ClientRequest.Builder requestBuilder = ClientRequest + .create(HttpMethod.GET, URI.create("/resource/test")) .attribute(WebClient.class.getName() + ".uriTemplate", "/resource/{name}"); - private ClientResponse response = ClientResponse.create(HttpStatus.OK).body("foo").build(); + private final ClientResponse response = ClientResponse.create(HttpStatus.OK).body("foo").build(); private ClientRequestObservationContext context; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapterTests.java index c208984e21..9705829af3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapterTests.java @@ -47,14 +47,15 @@ class ServerRequestObservationConventionAdapterTests { private static final String TEST_METRIC_NAME = "test.metric.name"; - private ServerRequestObservationConventionAdapter convention = new ServerRequestObservationConventionAdapter( + private final ServerRequestObservationConventionAdapter convention = new ServerRequestObservationConventionAdapter( TEST_METRIC_NAME, new DefaultWebMvcTagsProvider(), Collections.emptyList()); - private MockHttpServletRequest request = new MockHttpServletRequest("GET", "/resource/test"); + private final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/resource/test"); - private MockHttpServletResponse response = new MockHttpServletResponse(); + private final MockHttpServletResponse response = new MockHttpServletResponse(); - private ServerRequestObservationContext context = new ServerRequestObservationContext(this.request, this.response); + private final ServerRequestObservationContext context = new ServerRequestObservationContext(this.request, + this.response); @Test void customNameIsUsed() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java index a6b1299045..363ab9def3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java @@ -43,9 +43,9 @@ class CompositeHandlerExceptionResolverTests { private AnnotationConfigApplicationContext context; - private MockHttpServletRequest request = new MockHttpServletRequest(); + private final MockHttpServletRequest request = new MockHttpServletRequest(); - private MockHttpServletResponse response = new MockHttpServletResponse(); + private final MockHttpServletResponse response = new MockHttpServletResponse(); @Test void resolverShouldDelegateToOtherResolversInContext() { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java index 27c6bdb34f..96b11e1873 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java @@ -401,11 +401,11 @@ public abstract class EndpointDiscoverer, O exten private final EndpointId id; - private boolean enabledByDefault; + private final boolean enabledByDefault; private final Class filter; - private Set extensions = new LinkedHashSet<>(); + private final Set extensions = new LinkedHashSet<>(); EndpointBean(Environment environment, String beanName, Class beanType, Supplier beanSupplier) { MergedAnnotation annotation = MergedAnnotations.from(beanType, SearchStrategy.TYPE_HIERARCHY) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Health.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Health.java index 06339e19c2..35490ac2a6 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Health.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Health.java @@ -190,7 +190,7 @@ public final class Health extends HealthComponent { private Status status; - private Map details; + private final Map details; private Throwable exception; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java index 09a94dc655..914c1aed30 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java @@ -161,7 +161,7 @@ public class LoggersEndpoint { */ public static class LoggerLevelsDescriptor implements OperationResponseBody { - private String configuredLevel; + private final String configuredLevel; public LoggerLevelsDescriptor(LogLevel configuredLevel) { this.configuredLevel = getName(configuredLevel); @@ -182,7 +182,7 @@ public class LoggersEndpoint { */ public static class GroupLoggerLevelsDescriptor extends LoggerLevelsDescriptor { - private List members; + private final List members; public GroupLoggerLevelsDescriptor(LogLevel configuredLevel, List members) { super(configuredLevel); @@ -200,7 +200,7 @@ public class LoggersEndpoint { */ public static class SingleLoggerLevelsDescriptor extends LoggerLevelsDescriptor { - private String effectiveLevel; + private final String effectiveLevel; public SingleLoggerLevelsDescriptor(LoggerConfiguration configuration) { super(configuration.getConfiguredLevel()); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java index 044b950f6d..995e384621 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java @@ -146,9 +146,9 @@ public class HeapDumpWebEndpoint { */ protected static class HotSpotDiagnosticMXBeanHeapDumper implements HeapDumper { - private Object diagnosticMXBean; + private final Object diagnosticMXBean; - private Method dumpHeapMethod; + private final Method dumpHeapMethod; @SuppressWarnings("unchecked") protected HotSpotDiagnosticMXBeanHeapDumper() { @@ -189,9 +189,9 @@ public class HeapDumpWebEndpoint { */ private static final class OpenJ9DiagnosticsMXBeanHeapDumper implements HeapDumper { - private Object diagnosticMXBean; + private final Object diagnosticMXBean; - private Method dumpHeapMethod; + private final Method dumpHeapMethod; @SuppressWarnings("unchecked") private OpenJ9DiagnosticsMXBeanHeapDumper() { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManager.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManager.java index a6bb97e03c..f0a3453e70 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManager.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManager.java @@ -56,7 +56,7 @@ public class PrometheusPushGatewayManager { private final TaskScheduler scheduler; - private ScheduledFuture scheduled; + private final ScheduledFuture scheduled; /** * Create a new {@link PrometheusPushGatewayManager} instance using a single threaded diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthenticationAuditListener.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthenticationAuditListener.java index 586f725d6f..cc8839039b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthenticationAuditListener.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthenticationAuditListener.java @@ -53,7 +53,7 @@ public class AuthenticationAuditListener extends AbstractAuthenticationAuditList private static final String WEB_LISTENER_CHECK_CLASS = "org.springframework.security.web.authentication.switchuser.AuthenticationSwitchUserEvent"; - private WebAuditListener webListener = maybeCreateWebListener(); + private final WebAuditListener webListener = maybeCreateWebListener(); private static WebAuditListener maybeCreateWebListener() { if (ClassUtils.isPresent(WEB_LISTENER_CHECK_CLASS, null)) { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java index 074f344ee6..fcb3592ebd 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java @@ -497,9 +497,9 @@ class ConfigurationPropertiesReportEndpointSerializationTests { public static class InitializedMapAndListProperties extends Foo { - private Map map = new HashMap<>(); + private final Map map = new HashMap<>(); - private List list = new ArrayList<>(); + private final List list = new ArrayList<>(); public Map getMap() { return this.map; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java index 9fcd44822f..f8daf78c3a 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java @@ -435,7 +435,7 @@ class ConfigurationPropertiesReportEndpointTests { private Duration duration = Duration.ofSeconds(10); - private String ignored = "dummy"; + private final String ignored = "dummy"; public String getDbPassword() { return this.dbPassword; @@ -803,7 +803,7 @@ class ConfigurationPropertiesReportEndpointTests { private URI noPasswordUri = URI.create("http://user:@localhost:8080"); - private List simpleList = new ArrayList<>(); + private final List simpleList = new ArrayList<>(); private String rawSensitiveAddresses = "http://user:password@localhost:8080,http://user2:password2@localhost:8082"; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodParameterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodParameterTests.java index d1c324b074..c0993c820e 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodParameterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodParameterTests.java @@ -38,16 +38,17 @@ import static org.assertj.core.api.Assertions.assertThat; */ class OperationMethodParameterTests { - private Method example = ReflectionUtils.findMethod(getClass(), "example", String.class, String.class); + private final Method example = ReflectionUtils.findMethod(getClass(), "example", String.class, String.class); - private Method exampleJsr305 = ReflectionUtils.findMethod(getClass(), "exampleJsr305", String.class, String.class); - - private Method exampleMetaJsr305 = ReflectionUtils.findMethod(getClass(), "exampleMetaJsr305", String.class, + private final Method exampleJsr305 = ReflectionUtils.findMethod(getClass(), "exampleJsr305", String.class, String.class); - private Method exampleJsr305NonNull = ReflectionUtils.findMethod(getClass(), "exampleJsr305NonNull", String.class, + private final Method exampleMetaJsr305 = ReflectionUtils.findMethod(getClass(), "exampleMetaJsr305", String.class, String.class); + private final Method exampleJsr305NonNull = ReflectionUtils.findMethod(getClass(), "exampleJsr305NonNull", + String.class, String.class); + @Test void getNameShouldReturnName() { OperationMethodParameter parameter = new OperationMethodParameter("name", this.example.getParameters()[0]); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodParametersTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodParametersTests.java index 2a0fc98413..43fe32b8bb 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodParametersTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodParametersTests.java @@ -43,9 +43,9 @@ import static org.mockito.Mockito.mock; */ class OperationMethodParametersTests { - private Method exampleMethod = ReflectionUtils.findMethod(getClass(), "example", String.class); + private final Method exampleMethod = ReflectionUtils.findMethod(getClass(), "example", String.class); - private Method exampleNoParamsMethod = ReflectionUtils.findMethod(getClass(), "exampleNoParams"); + private final Method exampleNoParamsMethod = ReflectionUtils.findMethod(getClass(), "exampleNoParams"); @Test void createWhenMethodIsNullShouldThrowException() { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodTests.java index 577e3e63a4..462ccd342b 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodTests.java @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ class OperationMethodTests { - private Method exampleMethod = ReflectionUtils.findMethod(getClass(), "example", String.class); + private final Method exampleMethod = ReflectionUtils.findMethod(getClass(), "example", String.class); @Test void createWhenMethodIsNullShouldThrowException() { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanTests.java index 227229154c..771cadfee9 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanTests.java @@ -54,9 +54,9 @@ class EndpointMBeanTests { private static final String[] NO_SIGNATURE = {}; - private TestExposableJmxEndpoint endpoint = new TestExposableJmxEndpoint(new TestJmxOperation()); + private final TestExposableJmxEndpoint endpoint = new TestExposableJmxEndpoint(new TestJmxOperation()); - private TestJmxOperationResponseMapper responseMapper = new TestJmxOperationResponseMapper(); + private final TestJmxOperationResponseMapper responseMapper = new TestJmxOperationResponseMapper(); @Test void createWhenResponseMapperIsNullShouldThrowException() { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JacksonJmxOperationResponseMapperTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JacksonJmxOperationResponseMapperTests.java index 2b3b7273f7..60fbb57b41 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JacksonJmxOperationResponseMapperTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JacksonJmxOperationResponseMapperTests.java @@ -42,7 +42,7 @@ import static org.mockito.Mockito.spy; */ class JacksonJmxOperationResponseMapperTests { - private JacksonJmxOperationResponseMapper mapper = new JacksonJmxOperationResponseMapper(null); + private final JacksonJmxOperationResponseMapper mapper = new JacksonJmxOperationResponseMapper(null); private final BasicJsonTester json = new BasicJsonTester(getClass()); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporterTests.java index b4765c6882..e75b5e1f3d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporterTests.java @@ -61,9 +61,9 @@ class JmxEndpointExporterTests { @Spy private EndpointObjectNameFactory objectNameFactory = new TestEndpointObjectNameFactory(); - private JmxOperationResponseMapper responseMapper = new TestJmxOperationResponseMapper(); + private final JmxOperationResponseMapper responseMapper = new TestJmxOperationResponseMapper(); - private List endpoints = new ArrayList<>(); + private final List endpoints = new ArrayList<>(); @Captor private ArgumentCaptor objectCaptor; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/MBeanInfoFactoryTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/MBeanInfoFactoryTests.java index fbb349313f..6bedcb87b2 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/MBeanInfoFactoryTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/MBeanInfoFactoryTests.java @@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock; */ class MBeanInfoFactoryTests { - private MBeanInfoFactory factory = new MBeanInfoFactory(new TestJmxOperationResponseMapper()); + private final MBeanInfoFactory factory = new MBeanInfoFactory(new TestJmxOperationResponseMapper()); @Test void getMBeanInfoShouldReturnMBeanInfo() { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/RequestPredicateFactoryTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/RequestPredicateFactoryTests.java index 17170e19dc..2943fe1786 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/RequestPredicateFactoryTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/RequestPredicateFactoryTests.java @@ -42,7 +42,7 @@ class RequestPredicateFactoryTests { private final RequestPredicateFactory factory = new RequestPredicateFactory( new EndpointMediaTypes(Collections.emptyList(), Collections.emptyList())); - private String rootPath = "/root"; + private final String rootPath = "/root"; @Test void getRequestPredicateWhenHasMoreThanOneMatchAllThrowsException() { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/AbstractHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/AbstractHealthIndicatorTests.java index c193b36cc7..909dd8d99c 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/AbstractHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/AbstractHealthIndicatorTests.java @@ -94,7 +94,7 @@ class AbstractHealthIndicatorTests { static class TestHealthIndicator extends AbstractHealthIndicator { - private Consumer action; + private final Consumer action; TestHealthIndicator(String message, Consumer action) { super(message); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java index 5c2ef47692..854787305c 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java @@ -83,7 +83,7 @@ class HeapDumpWebEndpointWebIntegrationTests { private boolean available; - private String heapDump = "HEAPDUMP"; + private final String heapDump = "HEAPDUMP"; private File file; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java index b29425aeab..60f8374bda 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java @@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class MetricsEndpointWebIntegrationTests { - private static MeterRegistry registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock()); + private static final MeterRegistry registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock()); private final ObjectMapper mapper = new ObjectMapper(); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/data/DefaultRepositoryTagsProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/data/DefaultRepositoryTagsProviderTests.java index 14a5efd69f..8ca2cbc6ed 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/data/DefaultRepositoryTagsProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/data/DefaultRepositoryTagsProviderTests.java @@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock; */ class DefaultRepositoryTagsProviderTests { - private DefaultRepositoryTagsProvider provider = new DefaultRepositoryTagsProvider(); + private final DefaultRepositoryTagsProvider provider = new DefaultRepositoryTagsProvider(); @Test void repositoryTagsIncludesRepository() { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManagerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManagerTests.java index ae0b04fa41..c548ad8da1 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManagerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManagerTests.java @@ -61,9 +61,9 @@ class PrometheusPushGatewayManagerTests { @Mock private TaskScheduler scheduler; - private Duration pushRate = Duration.ofSeconds(1); + private final Duration pushRate = Duration.ofSeconds(1); - private Map groupingKey = Collections.singletonMap("foo", "bar"); + private final Map groupingKey = Collections.singletonMap("foo", "bar"); @Captor private ArgumentCaptor task; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizerTests.java index 6d7a65d8ce..3d3b017171 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizerTests.java @@ -34,11 +34,11 @@ class ObservationRestTemplateCustomizerTests { private static final String TEST_METRIC_NAME = "http.test.metric.name"; - private ObservationRegistry observationRegistry = TestObservationRegistry.create(); + private final ObservationRegistry observationRegistry = TestObservationRegistry.create(); - private RestTemplate restTemplate = new RestTemplate(); + private final RestTemplate restTemplate = new RestTemplate(); - private ObservationRestTemplateCustomizer customizer = new ObservationRestTemplateCustomizer( + private final ObservationRestTemplateCustomizer customizer = new ObservationRestTemplateCustomizer( this.observationRegistry, new DefaultClientRequestObservationConvention(TEST_METRIC_NAME)); @Test diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/DefaultWebClientExchangeTagsProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/DefaultWebClientExchangeTagsProviderTests.java index 80962805a9..f75a110744 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/DefaultWebClientExchangeTagsProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/DefaultWebClientExchangeTagsProviderTests.java @@ -44,7 +44,7 @@ class DefaultWebClientExchangeTagsProviderTests { private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate"; - private WebClientExchangeTagsProvider tagsProvider = new DefaultWebClientExchangeTagsProvider(); + private final WebClientExchangeTagsProvider tagsProvider = new DefaultWebClientExchangeTagsProvider(); private ClientRequest request; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java index 714d340237..43447c88f0 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java @@ -34,15 +34,15 @@ class ObservationWebClientCustomizerTests { private static final String TEST_METRIC_NAME = "http.test.metric.name"; - private TestObservationRegistry observationRegistry = TestObservationRegistry.create(); + private final TestObservationRegistry observationRegistry = TestObservationRegistry.create(); - private ClientRequestObservationConvention observationConvention = new DefaultClientRequestObservationConvention( + private final ClientRequestObservationConvention observationConvention = new DefaultClientRequestObservationConvention( TEST_METRIC_NAME); - private ObservationWebClientCustomizer customizer = new ObservationWebClientCustomizer(this.observationRegistry, - this.observationConvention); + private final ObservationWebClientCustomizer customizer = new ObservationWebClientCustomizer( + this.observationRegistry, this.observationConvention); - private WebClient.Builder clientBuilder = WebClient.builder(); + private final WebClient.Builder clientBuilder = WebClient.builder(); @Test void shouldCustomizeObservationConfiguration() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/AbstractRabbitListenerContainerFactoryConfigurer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/AbstractRabbitListenerContainerFactoryConfigurer.java index 9e25b3a1bc..47a1a77cb2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/AbstractRabbitListenerContainerFactoryConfigurer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/AbstractRabbitListenerContainerFactoryConfigurer.java @@ -45,7 +45,7 @@ public abstract class AbstractRabbitListenerContainerFactoryConfigurer retryTemplateCustomizers; - private RabbitProperties rabbitProperties; + private final RabbitProperties rabbitProperties; /** * Creates a new configurer that will use the given {@code rabbitProperties}. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitTemplateConfigurer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitTemplateConfigurer.java index 58417be263..6cecbb9b03 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitTemplateConfigurer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitTemplateConfigurer.java @@ -37,7 +37,7 @@ public class RabbitTemplateConfigurer { private List retryTemplateCustomizers; - private RabbitProperties rabbitProperties; + private final RabbitProperties rabbitProperties; /** * Creates a new configurer that will use the given {@code rabbitProperties}. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java index 61c5ec3389..f6c3f1783e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java @@ -81,7 +81,7 @@ class OnJndiCondition extends SpringBootCondition { protected static class JndiLocator extends JndiLocatorSupport { - private String[] locations; + private final String[] locations; public JndiLocator(String[] locations) { this.locations = locations; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.java index c4c76c0692..34ca52a8c7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.java @@ -87,7 +87,7 @@ public class MessageSourceAutoConfiguration { protected static class ResourceBundleCondition extends SpringBootCondition { - private static ConcurrentReferenceHashMap cache = new ConcurrentReferenceHashMap<>(); + private static final ConcurrentReferenceHashMap cache = new ConcurrentReferenceHashMap<>(); @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java index 7fa717ca9b..3151e0bb90 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java @@ -89,7 +89,7 @@ public class GraphQlWebMvcAutoConfiguration { private static final Log logger = LogFactory.getLog(GraphQlWebMvcAutoConfiguration.class); @SuppressWarnings("removal") - private static MediaType[] SUPPORTED_MEDIA_TYPES = new MediaType[] { MediaType.APPLICATION_GRAPHQL_RESPONSE, + private static final MediaType[] SUPPORTED_MEDIA_TYPES = new MediaType[] { MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL }; @Bean diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapProperties.java index ef563541a6..58c2b73c49 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapProperties.java @@ -58,7 +58,7 @@ public class EmbeddedLdapProperties { /** * Schema validation. */ - private Validation validation = new Validation(); + private final Validation validation = new Validation(); public int getPort() { return this.port; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java index 6bd99fe766..76b2424eaf 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java @@ -41,7 +41,7 @@ import org.springframework.util.StringUtils; */ public class ConditionEvaluationReportMessage { - private StringBuilder message; + private final StringBuilder message; public ConditionEvaluationReportMessage(ConditionEvaluationReport report) { this(report, "CONDITIONS EVALUATION REPORT"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java index 2c5e40402f..a73cf4672b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java @@ -69,7 +69,7 @@ public class MailProperties { /** * Additional JavaMail Session properties. */ - private Map properties = new HashMap<>(); + private final Map properties = new HashMap<>(); /** * Session JNDI name. When set, takes precedence over other Session settings. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.java index 0eebeff1c5..26ad37b90e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.java @@ -80,7 +80,7 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration { private final HibernateDefaultDdlAutoProvider defaultDdlAutoProvider; - private DataSourcePoolMetadataProvider poolMetadataProvider; + private final DataSourcePoolMetadataProvider poolMetadataProvider; private final List hibernatePropertiesCustomizers; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index 7bb9083eb7..d54ef0e832 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -1787,12 +1787,12 @@ public class ServerProperties { /** * Socket options as defined in org.xnio.Options. */ - private Map socket = new LinkedHashMap<>(); + private final Map socket = new LinkedHashMap<>(); /** * Server options as defined in io.undertow.UndertowOptions. */ - private Map server = new LinkedHashMap<>(); + private final Map server = new LinkedHashMap<>(); public Map getServer() { return this.server; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolver.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolver.java index ee8cd286d4..e3f513f50d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolver.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolver.java @@ -66,7 +66,7 @@ public class DefaultErrorViewResolver implements ErrorViewResolver, Ordered { SERIES_VIEWS = Collections.unmodifiableMap(views); } - private ApplicationContext applicationContext; + private final ApplicationContext applicationContext; private final Resources resources; @@ -145,7 +145,7 @@ public class DefaultErrorViewResolver implements ErrorViewResolver, Ordered { */ private static class HtmlResourceView implements View { - private Resource resource; + private final Resource resource; HtmlResourceView(Resource resource) { this.resource = resource; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessorTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessorTests.java index faa312ddeb..4bb45e6a9c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessorTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessorTests.java @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class AbstractDependsOnBeanFactoryPostProcessorTests { - private ApplicationContextRunner contextRunner = new ApplicationContextRunner() + private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(FooBarConfiguration.class); @Test diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java index 7fb151a4ca..82685205d4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java @@ -56,7 +56,7 @@ class AutoConfigurationImportSelectorTests { private final MockEnvironment environment = new MockEnvironment(); - private List filters = new ArrayList<>(); + private final List filters = new ArrayList<>(); @BeforeEach void setup() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java index 5bfb79e00d..51a1e24be3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java @@ -488,7 +488,7 @@ class ConditionalOnBeanTests { @TestAnnotation static class ExampleBean { - private String value; + private final String value; ExampleBean(String value) { this.value = value; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJndiTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJndiTests.java index 4e470ab631..f47349bf7b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJndiTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJndiTests.java @@ -51,7 +51,7 @@ class ConditionalOnJndiTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); - private MockableOnJndi condition = new MockableOnJndi(); + private final MockableOnJndi condition = new MockableOnJndi(); @BeforeEach void setupThreadContextClassLoader() { @@ -149,7 +149,7 @@ class ConditionalOnJndiTests { static class MockableOnJndi extends OnJndiCondition { - private boolean jndiAvailable = true; + private final boolean jndiAvailable = true; private String foundLocation; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java index f7087dd233..319a33ab78 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java @@ -741,7 +741,7 @@ class ConditionalOnMissingBeanTests { @TestAnnotation static class ExampleBean { - private String value; + private final String value; ExampleBean(String value) { this.value = value; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java index 4bd89c1b5a..b1194cad8f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java @@ -50,7 +50,7 @@ class ConditionalOnPropertyTests { private ConfigurableApplicationContext context; - private ConfigurableEnvironment environment = new StandardEnvironment(); + private final ConfigurableEnvironment environment = new StandardEnvironment(); @AfterEach void tearDown() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/OnClassConditionAutoConfigurationImportFilterTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/OnClassConditionAutoConfigurationImportFilterTests.java index b195632c88..436bc91e22 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/OnClassConditionAutoConfigurationImportFilterTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/OnClassConditionAutoConfigurationImportFilterTests.java @@ -35,9 +35,9 @@ import static org.mockito.Mockito.mock; */ class OnClassConditionAutoConfigurationImportFilterTests { - private OnClassCondition filter = new OnClassCondition(); + private final OnClassCondition filter = new OnClassCondition(); - private DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); + private final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); @BeforeEach void setup() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/city/City.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/city/City.java index 29e84bdca3..344e7d2a1c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/city/City.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/city/City.java @@ -32,11 +32,11 @@ public class City implements Serializable { @GeneratedValue private Long id; - private String name; + private final String name; private String state; - private Country country; + private final Country country; private String map; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/country/Country.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/country/Country.java index 2ab5a42671..98facb9bda 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/country/Country.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/country/Country.java @@ -31,7 +31,7 @@ public class Country implements Serializable { @GeneratedValue private Long id; - private String name; + private final String name; public Country(String name) { this.name = name; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisRepositoriesAutoConfigurationTests.java index e98e7b4fe1..57ad1559f3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisRepositoriesAutoConfigurationTests.java @@ -50,7 +50,7 @@ class RedisRepositoriesAutoConfigurationTests { public static RedisContainer redis = new RedisContainer().withStartupAttempts(5) .withStartupTimeout(Duration.ofMinutes(10)); - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @BeforeEach void setUp() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/GraphQlTestDataFetchers.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/GraphQlTestDataFetchers.java index f7d3cfe714..7e42d04cc4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/GraphQlTestDataFetchers.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/GraphQlTestDataFetchers.java @@ -31,7 +31,8 @@ import org.springframework.lang.Nullable; */ public final class GraphQlTestDataFetchers { - private static List books = Arrays.asList(new Book("book-1", "GraphQL for beginners", 100, "John GraphQL"), + private static final List books = Arrays.asList( + new Book("book-1", "GraphQL for beginners", 100, "John GraphQL"), new Book("book-2", "Harry Potter and the Philosopher's Stone", 223, "Joanne Rowling"), new Book("book-3", "Moby Dick", 635, "Moby Dick"), new Book("book-3", "Moby Dick", 635, "Moby Dick")); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java index 2b1e543d6c..c8dfb9f8b3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java @@ -55,7 +55,7 @@ class GroovyTemplateAutoConfigurationTests { private final BuildOutput buildOutput = new BuildOutput(getClass()); - private AnnotationConfigServletWebApplicationContext context = new AnnotationConfigServletWebApplicationContext(); + private final AnnotationConfigServletWebApplicationContext context = new AnnotationConfigServletWebApplicationContext(); @BeforeEach void setupContext() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProviderTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProviderTests.java index 026c93d4e1..ad7b7c9dca 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProviderTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProviderTests.java @@ -32,11 +32,11 @@ import static org.assertj.core.api.Assertions.assertThat; */ class GroovyTemplateAvailabilityProviderTests { - private TemplateAvailabilityProvider provider = new GroovyTemplateAvailabilityProvider(); + private final TemplateAvailabilityProvider provider = new GroovyTemplateAvailabilityProvider(); - private ResourceLoader resourceLoader = new DefaultResourceLoader(); + private final ResourceLoader resourceLoader = new DefaultResourceLoader(); - private MockEnvironment environment = new MockEnvironment(); + private final MockEnvironment environment = new MockEnvironment(); @Test void availabilityOfTemplateInDefaultLocation() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/gson/GsonAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/gson/GsonAutoConfigurationTests.java index 6e1f0e0aa5..1072fd28d8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/gson/GsonAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/gson/GsonAutoConfigurationTests.java @@ -241,7 +241,7 @@ class GsonAutoConfigurationTests { private Long data = 1L; @SuppressWarnings("unused") - private String owner = null; + private final String owner = null; public void setData(Long data) { this.data = data; @@ -254,7 +254,7 @@ class GsonAutoConfigurationTests { @SuppressWarnings("unused") class NestedObject { - private String data = "nested"; + private final String data = "nested"; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java index 0cab87e316..026a4867e9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java @@ -636,7 +636,7 @@ class JacksonAutoConfigurationTests { static class CustomModule extends SimpleModule { - private Set owners = new HashSet<>(); + private final Set owners = new HashSet<>(); @Override public void setupModule(SetupContext context) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java index 84a1de85af..74f998a3eb 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java @@ -80,7 +80,7 @@ class DataSourceJsonSerializationTests { static class TomcatDataSourceSerializer extends JsonSerializer { - private ConversionService conversionService = new DefaultConversionService(); + private final ConversionService conversionService = new DefaultConversionService(); @Override public void serialize(DataSource value, JsonGenerator jgen, SerializerProvider provider) throws IOException { @@ -99,7 +99,7 @@ class DataSourceJsonSerializationTests { static class GenericSerializerModifier extends BeanSerializerModifier { - private ConversionService conversionService = new DefaultConversionService(); + private final ConversionService conversionService = new DefaultConversionService(); @Override public List changeProperties(SerializationConfig config, BeanDescription beanDesc, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategyTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategyTests.java index f16b8324de..41ccb73bcb 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategyTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategyTests.java @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class ParentAwareNamingStrategyTests { - private ApplicationContextRunner contextRunner = new ApplicationContextRunner(); + private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); @Test void objectNameMatchesManagedResourceByDefault() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java index 703171253c..c749cfba3b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java @@ -462,7 +462,7 @@ class LiquibaseAutoConfigurationTests { @Configuration(proxyBeanMethods = false) static class CustomDataSourceConfiguration { - private String name = UUID.randomUUID().toString(); + private final String name = UUID.randomUUID().toString(); @Bean(destroyMethod = "shutdown") EmbeddedDatabase dataSource() throws SQLException { @@ -484,7 +484,7 @@ class LiquibaseAutoConfigurationTests { @Configuration(proxyBeanMethods = false) static class CustomDriverConfiguration { - private String name = UUID.randomUUID().toString(); + private final String name = UUID.randomUUID().toString(); @Bean SimpleDriverDataSource dataSource() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java index a3a9fb2ae3..39478c89ae 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java @@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @ExtendWith(OutputCaptureExtension.class) class ConditionEvaluationReportLoggingListenerTests { - private ConditionEvaluationReportLoggingListener initializer = new ConditionEvaluationReportLoggingListener(); + private final ConditionEvaluationReportLoggingListener initializer = new ConditionEvaluationReportLoggingListener(); @Test void logsDebugOnContextRefresh(CapturedOutput output) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java index 91b839c081..0c0322a2db 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java @@ -33,11 +33,11 @@ import static org.assertj.core.api.Assertions.assertThat; */ class SecurityPropertiesTests { - private SecurityProperties security = new SecurityProperties(); + private final SecurityProperties security = new SecurityProperties(); private Binder binder; - private MapConfigurationPropertySource source = new MapConfigurationPropertySource(); + private final MapConfigurationPropertySource source = new MapConfigurationPropertySource(); @BeforeEach void setUp() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesTests.java index 6b940ff5a3..14a7f4d19b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesTests.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; */ class OAuth2ClientPropertiesTests { - private OAuth2ClientProperties properties = new OAuth2ClientProperties(); + private final OAuth2ClientProperties properties = new OAuth2ClientProperties(); @Test void clientIdAbsentThrowsException() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java index 318b849faa..4b535fccd6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java @@ -79,7 +79,7 @@ import static org.mockito.Mockito.mock; */ class OAuth2ResourceServerAutoConfigurationTests { - private WebApplicationContextRunner contextRunner = new WebApplicationContextRunner() + private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner() .withConfiguration(AutoConfigurations.of(OAuth2ResourceServerAutoConfiguration.class)) .withUserConfiguration(TestConfig.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequestTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequestTests.java index 556a1d94e6..a5f2f5de84 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequestTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequestTests.java @@ -45,7 +45,7 @@ import static org.mockito.Mockito.mock; */ class StaticResourceRequestTests { - private StaticResourceRequest resourceRequest = StaticResourceRequest.INSTANCE; + private final StaticResourceRequest resourceRequest = StaticResourceRequest.INSTANCE; @Test void atCommonLocationsShouldMatchCommonLocations() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequestTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequestTests.java index 6744843b0b..5f25d22b5b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequestTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequestTests.java @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ class StaticResourceRequestTests { - private StaticResourceRequest resourceRequest = StaticResourceRequest.INSTANCE; + private final StaticResourceRequest resourceRequest = StaticResourceRequest.INSTANCE; @Test void atCommonLocationsShouldMatchCommonLocations() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/sql/init/SqlInitializationAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/sql/init/SqlInitializationAutoConfigurationTests.java index 6bf4c04bda..e9b3fbc29f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/sql/init/SqlInitializationAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/sql/init/SqlInitializationAutoConfigurationTests.java @@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class SqlInitializationAutoConfigurationTests { - private ApplicationContextRunner contextRunner = new ApplicationContextRunner() + private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(SqlInitializationAutoConfiguration.class)).withPropertyValues( "spring.datasource.generate-unique-name:true", "spring.r2dbc.generate-unique-name:true"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProvidersTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProvidersTests.java index 903e04463f..ffb7e693a7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProvidersTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProvidersTests.java @@ -49,11 +49,11 @@ class TemplateAvailabilityProvidersTests { @Mock private TemplateAvailabilityProvider provider; - private String view = "view"; + private final String view = "view"; - private ClassLoader classLoader = getClass().getClassLoader(); + private final ClassLoader classLoader = getClass().getClassLoader(); - private MockEnvironment environment = new MockEnvironment(); + private final MockEnvironment environment = new MockEnvironment(); @Mock private ResourceLoader resourceLoader; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidationAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidationAutoConfigurationTests.java index 6d9f801594..ad3b12830e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidationAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidationAutoConfigurationTests.java @@ -422,7 +422,7 @@ class ValidationAutoConfigurationTests { static class TestBeanPostProcessor implements BeanPostProcessor { - private Set postProcessed = new HashSet<>(); + private final Set postProcessed = new HashSet<>(); @Override public Object postProcessAfterInitialization(Object bean, String name) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapterTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapterTests.java index 8b5ffb37b9..c2fe68e2da 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapterTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapterTests.java @@ -134,7 +134,7 @@ class ValidatorAdapterTests { static class SampleData { @Min(42) - private int counter; + private final int counter; SampleData(int counter) { this.counter = counter; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizerTests.java index 662d51518e..7eb1cd5f04 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizerTests.java @@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock; */ class ReactiveWebServerFactoryCustomizerTests { - private ServerProperties properties = new ServerProperties(); + private final ServerProperties properties = new ServerProperties(); private ReactiveWebServerFactoryCustomizer customizer; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageIntegrationTests.java index 59cbd17916..b698f23106 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageIntegrationTests.java @@ -48,7 +48,7 @@ class WelcomePageIntegrationTests { @LocalServerPort private int port; - private TestRestTemplate template = new TestRestTemplate(); + private final TestRestTemplate template = new TestRestTemplate(); @Test void contentStrategyWithWelcomePage() throws Exception { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java index ecea4bfdc6..f0197a630f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java @@ -65,9 +65,9 @@ class DefaultErrorViewResolverTests { private Resources resourcesProperties; - private Map model = new HashMap<>(); + private final Map model = new HashMap<>(); - private HttpServletRequest request = new MockHttpServletRequest(); + private final HttpServletRequest request = new MockHttpServletRequest(); @BeforeEach void setup() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/RemappedErrorViewIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/RemappedErrorViewIntegrationTests.java index b5e25e65c0..1af4376cac 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/RemappedErrorViewIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/RemappedErrorViewIntegrationTests.java @@ -51,7 +51,7 @@ class RemappedErrorViewIntegrationTests { @LocalServerPort private int port; - private TestRestTemplate template = new TestRestTemplate(); + private final TestRestTemplate template = new TestRestTemplate(); @Test void directAccessToErrorPage() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java index c633277456..91d585110e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java @@ -78,7 +78,7 @@ import static org.junit.jupiter.api.Assertions.fail; */ class WebSocketMessagingAutoConfigurationTests { - private AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(); + private final AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(); private SockJsClient sockJsClient; @@ -255,9 +255,9 @@ class WebSocketMessagingAutoConfigurationTests { public static class Data { - private int foo; + private final int foo; - private String bar; + private final String bar; Data(int foo, String bar) { this.foo = foo; diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java index 9ccf1d3e10..fc34723e68 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java @@ -35,9 +35,9 @@ import org.springframework.util.StringUtils; @ConfigurationProperties(prefix = "spring.devtools") public class DevToolsProperties { - private Restart restart = new Restart(); + private final Restart restart = new Restart(); - private Livereload livereload = new Livereload(); + private final Livereload livereload = new Livereload(); @NestedConfigurationProperty private final RemoteDevToolsProperties remote = new RemoteDevToolsProperties(); diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsProperties.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsProperties.java index defa4b0a2a..4853d675eb 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsProperties.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsProperties.java @@ -46,9 +46,9 @@ public class RemoteDevToolsProperties { */ private String secretHeaderName = DEFAULT_SECRET_HEADER_NAME; - private Restart restart = new Restart(); + private final Restart restart = new Restart(); - private Proxy proxy = new Proxy(); + private final Proxy proxy = new Proxy(); public String getContextPath() { return this.contextPath; diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcher.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcher.java index e2c0f1e39d..57762ecfcd 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcher.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcher.java @@ -39,7 +39,7 @@ public class ClassPathFileSystemWatcher implements InitializingBean, DisposableB private final FileSystemWatcher fileSystemWatcher; - private ClassPathRestartStrategy restartStrategy; + private final ClassPathRestartStrategy restartStrategy; private ApplicationContext applicationContext; diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/DirectorySnapshot.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/DirectorySnapshot.java index 040a69e02c..899714d82a 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/DirectorySnapshot.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/DirectorySnapshot.java @@ -43,7 +43,7 @@ class DirectorySnapshot { private final Date time; - private Set files; + private final Set files; /** * Create a new {@link DirectorySnapshot} for the given directory. diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java index 99e90802ec..b34434b299 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java @@ -237,7 +237,7 @@ public class FileSystemWatcher { private Map directories; - private SnapshotStateRepository snapshotStateRepository; + private final SnapshotStateRepository snapshotStateRepository; private Watcher(AtomicInteger remainingScans, List listeners, FileFilter triggerFilter, long pollInterval, long quietPeriod, Map directories, diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java index fe1d58d233..a197cab94b 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java @@ -139,7 +139,7 @@ public class RemoteClientConfiguration implements InitializingBean { private final String remoteUrl; - private ExecutorService executor = Executors.newSingleThreadExecutor(); + private final ExecutorService executor = Executors.newSingleThreadExecutor(); LiveReloadConfiguration(DevToolsProperties properties, ClientHttpRequestFactory clientHttpRequestFactory, @Value("${remoteUrl}") String remoteUrl) { diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java index fd3ec6a918..bdc69f02d8 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java @@ -106,7 +106,7 @@ public class Restarter { private boolean enabled = true; - private URL[] initialUrls; + private final URL[] initialUrls; private final String mainClassName; diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java index cf3a9c3335..008d95230e 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java @@ -113,7 +113,7 @@ public class HttpTunnelConnection implements TunnelConnection { private boolean open = true; - private AtomicLong requestSeq = new AtomicLong(); + private final AtomicLong requestSeq = new AtomicLong(); public TunnelChannel(WritableByteChannel incomingChannel, Closeable closeable) { this.forwarder = new HttpTunnelPayloadForwarder(incomingChannel); diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java index 865946206f..189a5b861b 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java @@ -214,7 +214,7 @@ public class HttpTunnelServer { private boolean closed; - private AtomicLong responseSeq = new AtomicLong(); + private final AtomicLong responseSeq = new AtomicLong(); private long lastHttpRequestTime; @@ -364,7 +364,7 @@ public class HttpTunnelServer { private final ServerHttpResponse response; - private ServerHttpAsyncRequestControl async; + private final ServerHttpAsyncRequestControl async; private volatile boolean complete = false; diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerHandler.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerHandler.java index 1ca001a141..5b39e2f740 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerHandler.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerHandler.java @@ -31,7 +31,7 @@ import org.springframework.util.Assert; */ public class HttpTunnelServerHandler implements Handler { - private HttpTunnelServer server; + private final HttpTunnelServer server; /** * Create a new {@link HttpTunnelServerHandler} instance. diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java index 0b2641a98d..20d5f73caa 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ class ClassPathChangedEventTests { - private Object source = new Object(); + private final Object source = new Object(); @Test void changeSetMustNotBeNull() { diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java index f98c92a44c..8e88690ae2 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java @@ -117,7 +117,7 @@ class ClassPathFileSystemWatcherTests { static class Listener implements ApplicationListener { - private List events = new CopyOnWriteArrayList<>(); + private final List events = new CopyOnWriteArrayList<>(); @Override public void onApplicationEvent(ClassPathChangedEvent event) { diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java index 52c56ab951..03f463226f 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java @@ -50,7 +50,7 @@ class FileSystemWatcherTests { private FileSystemWatcher watcher; - private List> changes = Collections.synchronizedList(new ArrayList<>()); + private final List> changes = Collections.synchronizedList(new ArrayList<>()); @TempDir File tempDir; diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java index 43b883149b..984b55c6c4 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java @@ -54,11 +54,11 @@ class DispatcherTests { @Mock private AccessManager accessManager; - private MockHttpServletResponse response = new MockHttpServletResponse(); + private final MockHttpServletResponse response = new MockHttpServletResponse(); - private ServerHttpRequest serverRequest = new ServletServerHttpRequest(new MockHttpServletRequest()); + private final ServerHttpRequest serverRequest = new ServletServerHttpRequest(new MockHttpServletRequest()); - private ServerHttpResponse serverResponse = new ServletServerHttpResponse(this.response); + private final ServerHttpResponse serverResponse = new ServletServerHttpResponse(this.response); @Test void accessManagerMustNotBeNull() { diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/UrlHandlerMapperTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/UrlHandlerMapperTests.java index 2e5eaec18d..807239827e 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/UrlHandlerMapperTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/UrlHandlerMapperTests.java @@ -35,7 +35,7 @@ import static org.mockito.Mockito.mock; */ class UrlHandlerMapperTests { - private Handler handler = mock(Handler.class); + private final Handler handler = mock(Handler.class); @Test void requestUriMustNotBeNull() { diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java index bb0761fbe4..4308908a96 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; */ class MainMethodTests { - private static ThreadLocal mainMethod = new ThreadLocal<>(); + private static final ThreadLocal mainMethod = new ThreadLocal<>(); private Method actualMain; diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java index a70f1f36d9..4e5e84b22d 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java @@ -40,9 +40,9 @@ import static org.mockito.Mockito.mock; */ public class MockRestarter implements BeforeEachCallback, AfterEachCallback, ParameterResolver { - private Map attributes = new HashMap<>(); + private final Map attributes = new HashMap<>(); - private Restarter mock = mock(Restarter.class); + private final Restarter mock = mock(Restarter.class); public Restarter getMock() { return this.mock; diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java index 65ea8dab2a..b386824df0 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock; */ class ClassLoaderFilesTests { - private ClassLoaderFiles files = new ClassLoaderFiles(); + private final ClassLoaderFiles files = new ClassLoaderFiles(); @Test void addFileNameMustNotBeNull() { diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceDirectoryUrlFilterTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceDirectoryUrlFilterTests.java index df9a4fe0b9..6ca346a3fb 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceDirectoryUrlFilterTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceDirectoryUrlFilterTests.java @@ -52,7 +52,7 @@ class DefaultSourceDirectoryUrlFilterTests { COMMON_POSTFIXES = Collections.unmodifiableList(postfixes); } - private DefaultSourceDirectoryUrlFilter filter = new DefaultSourceDirectoryUrlFilter(); + private final DefaultSourceDirectoryUrlFilter filter = new DefaultSourceDirectoryUrlFilter(); @Test void mavenSourceDirectory() throws Exception { diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java index 228a41779c..46ef78dd2c 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java @@ -43,11 +43,11 @@ public class MockClientHttpRequestFactory implements ClientHttpRequestFactory { private static final byte[] NO_DATA = {}; - private AtomicLong seq = new AtomicLong(); + private final AtomicLong seq = new AtomicLong(); - private Deque responses = new ArrayDeque<>(); + private final Deque responses = new ArrayDeque<>(); - private List executedRequests = new ArrayList<>(); + private final List executedRequests = new ArrayList<>(); @Override public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException { diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnectionTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnectionTests.java index 717e778a43..f3e214a226 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnectionTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnectionTests.java @@ -61,7 +61,7 @@ class HttpTunnelConnectionTests { @Mock private Closeable closeable; - private MockClientHttpRequestFactory requestFactory = new MockClientHttpRequestFactory(); + private final MockClientHttpRequestFactory requestFactory = new MockClientHttpRequestFactory(); @BeforeEach void setup() { diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java index cd920e1796..99c3875ad4 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ class TunnelClientTests { - private MockTunnelConnection tunnelConnection = new MockTunnelConnection(); + private final MockTunnelConnection tunnelConnection = new MockTunnelConnection(); @Test void listenPortMustNotBeNegative() { diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java index 2f1304e3f6..53a328a4b9 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java @@ -346,11 +346,11 @@ class HttpTunnelServerTests { private int timeout; - private BlockingDeque outgoing = new LinkedBlockingDeque<>(); + private final BlockingDeque outgoing = new LinkedBlockingDeque<>(); - private ByteArrayOutputStream written = new ByteArrayOutputStream(); + private final ByteArrayOutputStream written = new ByteArrayOutputStream(); - private AtomicBoolean open = new AtomicBoolean(true); + private final AtomicBoolean open = new AtomicBoolean(true); void setTimeout(int timeout) { this.timeout = timeout; diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/SocketTargetServerConnectionTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/SocketTargetServerConnectionTests.java index 07b1e75b29..0d619f5c20 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/SocketTargetServerConnectionTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/SocketTargetServerConnectionTests.java @@ -85,7 +85,7 @@ class SocketTargetServerConnectionTests { static class MockServer { - private ServerSocketChannel serverSocket; + private final ServerSocketChannel serverSocket; private byte[] send; diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/nativeimage/advanced/nestedconfigurationproperties/MyProperties.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/nativeimage/advanced/nestedconfigurationproperties/MyProperties.java index d16229208c..69e3bae254 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/nativeimage/advanced/nestedconfigurationproperties/MyProperties.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/nativeimage/advanced/nestedconfigurationproperties/MyProperties.java @@ -25,7 +25,7 @@ public class MyProperties { private String name; @NestedConfigurationProperty - private Nested nested = new Nested(); + private final Nested nested = new Nested(); // @fold:on // getters / setters... public String getName() { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/StandardAnnotationCustomizableTypeExcludeFilter.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/StandardAnnotationCustomizableTypeExcludeFilter.java index 9ada5057cc..279b2a808c 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/StandardAnnotationCustomizableTypeExcludeFilter.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/StandardAnnotationCustomizableTypeExcludeFilter.java @@ -49,7 +49,7 @@ public abstract class StandardAnnotationCustomizableTypeExcludeFilter annotation; + private final MergedAnnotation annotation; protected StandardAnnotationCustomizableTypeExcludeFilter(Class testClass) { this.annotation = MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS) diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/client/MockRestServiceServerAutoConfiguration.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/client/MockRestServiceServerAutoConfiguration.java index d6c33fba62..6e93cd07b6 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/client/MockRestServiceServerAutoConfiguration.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/client/MockRestServiceServerAutoConfiguration.java @@ -77,7 +77,7 @@ public class MockRestServiceServerAutoConfiguration { */ private static class DeferredRequestExpectationManager implements RequestExpectationManager { - private MockServerRestTemplateCustomizer customizer; + private final MockServerRestTemplateCustomizer customizer; DeferredRequestExpectationManager(MockServerRestTemplateCustomizer customizer) { this.customizer = customizer; diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactoryTests.java index 827494a37e..cf8b50529d 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactoryTests.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class OverrideAutoConfigurationContextCustomizerFactoryTests { - private OverrideAutoConfigurationContextCustomizerFactory factory = new OverrideAutoConfigurationContextCustomizerFactory(); + private final OverrideAutoConfigurationContextCustomizerFactory factory = new OverrideAutoConfigurationContextCustomizerFactory(); @Test void getContextCustomizerWhenHasNoAnnotationShouldReturnNull() { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/jdbc/ExampleEntity.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/jdbc/ExampleEntity.java index 92bbc754b3..ef41029b8b 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/jdbc/ExampleEntity.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/jdbc/ExampleEntity.java @@ -30,9 +30,9 @@ public class ExampleEntity { @Id private Long id; - private String name; + private final String name; - private String reference; + private final String reference; public ExampleEntity(String name, String reference) { this.name = name; diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java index a2424ef339..c9d472046c 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java @@ -38,11 +38,11 @@ import static org.mockito.Mockito.mock; */ class TypeExcludeFiltersContextCustomizerFactoryTests { - private TypeExcludeFiltersContextCustomizerFactory factory = new TypeExcludeFiltersContextCustomizerFactory(); + private final TypeExcludeFiltersContextCustomizerFactory factory = new TypeExcludeFiltersContextCustomizerFactory(); - private MergedContextConfiguration mergedContextConfiguration = mock(MergedContextConfiguration.class); + private final MergedContextConfiguration mergedContextConfiguration = mock(MergedContextConfiguration.class); - private ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(); + private final ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(); @Test void getContextCustomizerWhenHasNoAnnotationShouldReturnNull() { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/graphql/GraphQlTypeExcludeFilterTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/graphql/GraphQlTypeExcludeFilterTests.java index a84ebd26c7..1b6cf098a3 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/graphql/GraphQlTypeExcludeFilterTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/graphql/GraphQlTypeExcludeFilterTests.java @@ -52,7 +52,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class GraphQlTypeExcludeFilterTests { - private MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); + private final MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); @Test void matchWhenHasNoControllers() throws Exception { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleCustomObject.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleCustomObject.java index cc9b68901c..6b2fd8fe00 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleCustomObject.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleCustomObject.java @@ -23,7 +23,7 @@ package org.springframework.boot.test.autoconfigure.json.app; */ public class ExampleCustomObject { - private String value; + private final String value; public ExampleCustomObject(String value) { this.value = value; diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java index 535d8f6f99..f2c8ebd45b 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java @@ -42,7 +42,7 @@ import static org.mockito.Mockito.mock; */ class PropertyMappingContextCustomizerFactoryTests { - private PropertyMappingContextCustomizerFactory factory = new PropertyMappingContextCustomizerFactory(); + private final PropertyMappingContextCustomizerFactory factory = new PropertyMappingContextCustomizerFactory(); @Test void getContextCustomizerWhenHasNoMappingShouldNotAddPropertySource() { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/ExampleRestClient.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/ExampleRestClient.java index 6468c30e8e..5e41374766 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/ExampleRestClient.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/ExampleRestClient.java @@ -28,7 +28,7 @@ import org.springframework.web.client.RestTemplate; @Service public class ExampleRestClient { - private RestTemplate restTemplate; + private final RestTemplate restTemplate; public ExampleRestClient(RestTemplateBuilder builder) { this.restTemplate = builder.rootUri("https://example.com").build(); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTypeExcludeFilterTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTypeExcludeFilterTests.java index 1a0fba2da3..251e25cf7d 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTypeExcludeFilterTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTypeExcludeFilterTests.java @@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class WebFluxTypeExcludeFilterTests { - private MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); + private final MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); @Test void matchWhenHasNoControllers() throws Exception { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilterTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilterTests.java index 764d9dfba7..a596814e72 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilterTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilterTests.java @@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class WebMvcTypeExcludeFilterTests { - private MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); + private final MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); @Test void matchWhenHasNoControllers() throws Exception { diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/FilteredClassLoader.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/FilteredClassLoader.java index 5d6a8236c3..e8257deb28 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/FilteredClassLoader.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/FilteredClassLoader.java @@ -146,7 +146,7 @@ public class FilteredClassLoader extends URLClassLoader implements SmartClassLoa */ public static final class ClassFilter implements Predicate { - private Class[] hiddenClasses; + private final Class[] hiddenClasses; private ClassFilter(Class[] hiddenClasses) { this.hiddenClasses = hiddenClasses; diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java index 1e0d5cb143..55fb5e8dbb 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java @@ -95,11 +95,11 @@ public class MockitoPostProcessor implements InstantiationAwareBeanPostProcessor private final MockitoBeans mockitoBeans = new MockitoBeans(); - private Map beanNameRegistry = new HashMap<>(); + private final Map beanNameRegistry = new HashMap<>(); - private Map fieldRegistry = new HashMap<>(); + private final Map fieldRegistry = new HashMap<>(); - private Map spies = new HashMap<>(); + private final Map spies = new HashMap<>(); /** * Create a new {@link MockitoPostProcessor} instance with the given initial diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCapture.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCapture.java index a561fac758..9215ef3942 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCapture.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCapture.java @@ -318,7 +318,7 @@ class OutputCapture implements CapturedOutput { */ private static class AnsiOutputState { - private Enabled saved; + private final Enabled saved; AnsiOutputState() { this.saved = AnsiOutput.getEnabled(); diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java index 308e876b98..00d92f7dc8 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java @@ -55,7 +55,7 @@ public class OutputCaptureRule implements TestRule, CapturedOutput { private final OutputCapture delegate = new OutputCapture(); - private List> matchers = new ArrayList<>(); + private final List> matchers = new ArrayList<>(); @Override public Statement apply(Statement base, Description description) { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AnnotatedClassFinderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AnnotatedClassFinderTests.java index 02836265b3..9c60a8da18 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AnnotatedClassFinderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AnnotatedClassFinderTests.java @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ class AnnotatedClassFinderTests { - private AnnotatedClassFinder finder = new AnnotatedClassFinder(SpringBootConfiguration.class); + private final AnnotatedClassFinder finder = new AnnotatedClassFinder(SpringBootConfiguration.class); @Test void findFromClassWhenSourceIsNullShouldThrowException() { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java index 125572fc5c..927a96dfb3 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java @@ -41,7 +41,7 @@ import static org.mockito.Mockito.mock; */ class ImportsContextCustomizerFactoryTests { - private ImportsContextCustomizerFactory factory = new ImportsContextCustomizerFactory(); + private final ImportsContextCustomizerFactory factory = new ImportsContextCustomizerFactory(); @Test void getContextCustomizerWhenHasNoImportAnnotationShouldReturnNull() { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertTests.java index c3961558be..0e80848e90 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertTests.java @@ -44,7 +44,7 @@ class ApplicationContextAssertTests { private StaticApplicationContext context; - private RuntimeException failure = new RuntimeException(); + private final RuntimeException failure = new RuntimeException(); @BeforeEach void setup() { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java index 759ea2de78..b991f6e8e5 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java @@ -35,9 +35,9 @@ import static org.assertj.core.api.Assertions.assertThat; */ class TestTypeExcludeFilterTests { - private TestTypeExcludeFilter filter = new TestTypeExcludeFilter(); + private final TestTypeExcludeFilter filter = new TestTypeExcludeFilter(); - private MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); + private final MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); @Test void matchesJUnit4TestClass() throws Exception { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/BasicJsonTesterTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/BasicJsonTesterTests.java index 463d90c142..743b0590ed 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/BasicJsonTesterTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/BasicJsonTesterTests.java @@ -40,7 +40,7 @@ class BasicJsonTesterTests { private static final String JSON = "{\"spring\":[\"boot\",\"framework\"]}"; - private BasicJsonTester json = new BasicJsonTester(getClass()); + private final BasicJsonTester json = new BasicJsonTester(getClass()); @Test void createWhenResourceLoadClassIsNullShouldThrowException() { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentAssertTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentAssertTests.java index 5d729cde6e..38ccbe89ed 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentAssertTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentAssertTests.java @@ -60,7 +60,7 @@ class JsonContentAssertTests { private static final String NULLS = loadJson("nulls.json"); - private static JSONComparator COMPARATOR = new DefaultComparator(JSONCompareMode.LENIENT); + private static final JSONComparator COMPARATOR = new DefaultComparator(JSONCompareMode.LENIENT); @TempDir public Path tempDir; diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java index 0b8cb7ea2b..e244c3ab10 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; */ class DefinitionsParserTests { - private DefinitionsParser parser = new DefinitionsParser(); + private final DefinitionsParser parser = new DefinitionsParser(); @Test void parseSingleMockBean() { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListenerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListenerTests.java index 05d8ed51fa..7c66530168 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListenerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListenerTests.java @@ -45,7 +45,7 @@ import static org.mockito.Mockito.mock; @ExtendWith(MockitoExtension.class) class MockitoTestExecutionListenerTests { - private MockitoTestExecutionListener listener = new MockitoTestExecutionListener(); + private final MockitoTestExecutionListener listener = new MockitoTestExecutionListener(); @Mock private ApplicationContext applicationContext; diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/system/OutputCaptureTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/system/OutputCaptureTests.java index 308827e0ae..3d4e060d09 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/system/OutputCaptureTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/system/OutputCaptureTests.java @@ -43,7 +43,7 @@ class OutputCaptureTests { private TestPrintStream systemErr; - private TestOutputCapture output = new TestOutputCapture(); + private final TestOutputCapture output = new TestOutputCapture(); @BeforeEach void replaceSystemStreams() { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/SpringBootTestRandomPortEnvironmentPostProcessorTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/SpringBootTestRandomPortEnvironmentPostProcessorTests.java index 578f50b655..af70722e09 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/SpringBootTestRandomPortEnvironmentPostProcessorTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/SpringBootTestRandomPortEnvironmentPostProcessorTests.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ class SpringBootTestRandomPortEnvironmentPostProcessorTests { - private SpringBootTestRandomPortEnvironmentPostProcessor postProcessor = new SpringBootTestRandomPortEnvironmentPostProcessor(); + private final SpringBootTestRandomPortEnvironmentPostProcessor postProcessor = new SpringBootTestRandomPortEnvironmentPostProcessor(); private MockEnvironment environment; diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java index 2fd99419ca..20c33bfdf8 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java @@ -53,7 +53,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat @ExtendWith(MockitoExtension.class) class RootUriRequestExpectationManagerTests { - private String uri = "https://example.com"; + private final String uri = "https://example.com"; @Mock private RequestExpectationManager delegate; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/json/JsonStreamTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/json/JsonStreamTests.java index 285cc599e3..917d9743a6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/json/JsonStreamTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/json/JsonStreamTests.java @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class JsonStreamTests extends AbstractJsonTests { - private JsonStream jsonStream; + private final JsonStream jsonStream; JsonStreamTests() { this.jsonStream = new JsonStream(getObjectMapper()); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/socket/FileDescriptorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/socket/FileDescriptorTests.java index 1c25f597ca..d669b47584 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/socket/FileDescriptorTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/socket/FileDescriptorTests.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class FileDescriptorTests { - private int sourceHandle = 123; + private final int sourceHandle = 123; private int closedHandle = 0; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/SentenceExtractorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/SentenceExtractorTests.java index 95b2fe9d72..4614d1e57a 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/SentenceExtractorTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/SentenceExtractorTests.java @@ -29,7 +29,7 @@ class SentenceExtractorTests { private static final String NEW_LINE = System.lineSeparator(); - private SentenceExtractor extractor = new SentenceExtractor(); + private final SentenceExtractor extractor = new SentenceExtractor(); @Test void extractFirstSentence() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java index 2c27e48c6e..1aadadec91 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java @@ -113,7 +113,7 @@ public abstract class AbstractFieldValuesProcessorTests { private FieldValuesParser processor; - private Map values = new HashMap<>(); + private final Map values = new HashMap<>(); @Override public synchronized void init(ProcessingEnvironment env) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/PomCondition.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/PomCondition.java index 62f483e07b..1214cb6b79 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/PomCondition.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/PomCondition.java @@ -35,9 +35,9 @@ import org.springframework.util.FileCopyUtils; */ class PomCondition extends Condition { - private Set expectedContents; + private final Set expectedContents; - private Set notExpectedContents; + private final Set notExpectedContents; PomCondition() { this(new HashSet<>(), new HashSet<>()); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuild.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuild.java index 2884ba17f3..b1fa01c228 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuild.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuild.java @@ -83,11 +83,11 @@ public class GradleBuild { private GradleVersion expectDeprecationWarnings; - private List expectedDeprecationMessages = new ArrayList<>(); + private final List expectedDeprecationMessages = new ArrayList<>(); private boolean configurationCache = false; - private Map scriptProperties = new HashMap<>(); + private final Map scriptProperties = new HashMap<>(); public GradleBuild() { this(Dsl.GROOVY); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuildExtension.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuildExtension.java index ee2583cd9a..2dd557b0ec 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuildExtension.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuildExtension.java @@ -38,7 +38,7 @@ public class GradleBuildExtension implements BeforeEachCallback, AfterEachCallba private static final Pattern GRADLE_VERSION_PATTERN = Pattern.compile("\\[Gradle .+\\]"); - private Dsl dsl = Dsl.GROOVY; + private final Dsl dsl = Dsl.GROOVY; @Override public void beforeEach(ExtensionContext context) throws Exception { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListCommand.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListCommand.java index 7b6e062837..f278260e70 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListCommand.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListCommand.java @@ -27,7 +27,7 @@ import java.util.Map; */ class ListCommand extends Command { - private Context context; + private final Context context; ListCommand(Context context) { super("list", "List layers from the jar that can be extracted", Options.none(), Parameters.none()); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractCommandTests.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractCommandTests.java index bc098be1b4..babe99093c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractCommandTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractCommandTests.java @@ -75,7 +75,7 @@ class ExtractCommandTests { private File extract; - private Layers layers = new TestLayers(); + private final Layers layers = new TestLayers(); private ExtractCommand command; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/TestPrintStream.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/TestPrintStream.java index 2f116f32a3..1bdba53b70 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/TestPrintStream.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/TestPrintStream.java @@ -37,7 +37,7 @@ import org.springframework.util.FileCopyUtils; */ class TestPrintStream extends PrintStream implements AssertProvider { - private Class testClass; + private final Class testClass; TestPrintStream(Object testInstance) { super(new ByteArrayOutputStream()); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/ImagePackager.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/ImagePackager.java index 213cb7800b..ac1e54c539 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/ImagePackager.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/ImagePackager.java @@ -71,7 +71,7 @@ public class ImagePackager extends Packager { */ private static class DelegatingJarWriter extends AbstractJarWriter { - private BiConsumer exporter; + private final BiConsumer exporter; DelegatingJarWriter(BiConsumer exporter) { this.exporter = exporter; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JavaExecutable.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JavaExecutable.java index 966ac446cc..750d5879a9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JavaExecutable.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JavaExecutable.java @@ -31,7 +31,7 @@ import org.springframework.util.StringUtils; */ public class JavaExecutable { - private File file; + private final File file; public JavaExecutable() { String javaHome = System.getProperty("java.home"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java index 1c35c75559..9eee659ca0 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java @@ -37,7 +37,7 @@ public class RunProcess { private static final long JUST_ENDED_LIMIT = 500; - private File workingDirectory; + private final File workingDirectory; private final String[] command; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java index 6d5b3b96ed..641cf29f49 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java @@ -722,9 +722,9 @@ abstract class AbstractPackagerTests

{ private static final Layer DEFAULT_LAYER = new Layer("default"); - private Set layers = new LinkedHashSet<>(); + private final Set layers = new LinkedHashSet<>(); - private Map libraries = new HashMap<>(); + private final Map libraries = new HashMap<>(); TestLayers() { this.layers.add(DEFAULT_LAYER); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/ImplicitLayerResolverTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/ImplicitLayerResolverTests.java index 44350aafb4..520fc26ab9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/ImplicitLayerResolverTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/ImplicitLayerResolverTests.java @@ -30,7 +30,7 @@ import static org.mockito.Mockito.mock; */ class ImplicitLayerResolverTests { - private Layers layers = Layers.IMPLICIT; + private final Layers layers = Layers.IMPLICIT; @Test void iteratorReturnsLayers() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/SizeCalculatingEntryWriterTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/SizeCalculatingEntryWriterTests.java index 5207a3dbd2..3376338934 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/SizeCalculatingEntryWriterTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/SizeCalculatingEntryWriterTests.java @@ -60,7 +60,7 @@ class SizeCalculatingEntryWriterTests { private static class TestEntryWriter implements EntryWriter { - private byte[] bytes; + private final byte[] bytes; TestEntryWriter(int size) { this.bytes = new byte[size]; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java index be9bc1b086..0873407852 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java @@ -49,7 +49,7 @@ public class ExplodedArchive implements Archive { private final boolean recursive; - private File manifestFile; + private final File manifestFile; private Manifest manifest; @@ -147,7 +147,7 @@ public class ExplodedArchive implements Archive { private FileEntry current; - private String rootUrl; + private final String rootUrl; AbstractIterator(File root, boolean recursive, EntryFilter searchFilter, EntryFilter includeFilter) { this.root = root; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java index f272e64d13..6d56fa2389 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java @@ -40,7 +40,7 @@ class JarEntry extends java.util.jar.JarEntry implements FileHeader { private final JarFile jarFile; - private long localHeaderOffset; + private final long localHeaderOffset; private volatile JarEntryCertification certification; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java index 38d4c67c35..502c450fa7 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java @@ -79,9 +79,9 @@ public class JarFile extends AbstractJarFile implements Iterable manifestSupplier; + private final Supplier manifestSupplier; private SoftReference manifest; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java index 3b5ba8d99a..c9286b3e8b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java @@ -37,7 +37,7 @@ import java.security.Permission; */ final class JarURLConnection extends java.net.JarURLConnection { - private static ThreadLocal useFastExceptions = new ThreadLocal<>(); + private static final ThreadLocal useFastExceptions = new ThreadLocal<>(); private static final FileNotFoundException FILE_NOT_FOUND_EXCEPTION = new FileNotFoundException( "Jar file or entry not found"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/CentralDirectoryParserTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/CentralDirectoryParserTests.java index 62f35f0010..81ed750ed6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/CentralDirectoryParserTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/CentralDirectoryParserTests.java @@ -90,7 +90,7 @@ class CentralDirectoryParserTests { static class Collector implements CentralDirectoryVisitor { - private List headers = new ArrayList<>(); + private final List headers = new ArrayList<>(); @Override public void visitStart(CentralDirectoryEndRecord endRecord, RandomAccessData centralDirectoryData) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ArtifactsLibrariesTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ArtifactsLibrariesTests.java index 1e4eceed03..649708c587 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ArtifactsLibrariesTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ArtifactsLibrariesTests.java @@ -62,7 +62,7 @@ class ArtifactsLibrariesTests { private Set artifacts; - private File file = new File("."); + private final File file = new File("."); private ArtifactsLibraries libs; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-properties-migrator/src/test/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporterTests.java b/spring-boot-project/spring-boot-tools/spring-boot-properties-migrator/src/test/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporterTests.java index 157e4c4e50..f353eb923d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-properties-migrator/src/test/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporterTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-properties-migrator/src/test/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporterTests.java @@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class PropertiesMigrationReporterTests { - private ConfigurableEnvironment environment = new MockEnvironment(); + private final ConfigurableEnvironment environment = new MockEnvironment(); @Test void reportIsNullWithNoMatchingKeys() { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java index 489f23ec87..613143a09b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java @@ -39,7 +39,7 @@ import org.springframework.util.Assert; */ class ExitCodeGenerators implements Iterable { - private List generators = new ArrayList<>(); + private final List generators = new ArrayList<>(); void addAll(Throwable exception, ExitCodeExceptionMapper... mappers) { Assert.notNull(exception, "Exception must not be null"); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java index a80189bda3..5f86161ebc 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java @@ -51,7 +51,7 @@ public class ResourceBanner implements Banner { private static final Log logger = LogFactory.getLog(ResourceBanner.class); - private Resource resource; + private final Resource resource; public ResourceBanner(Resource resource) { Assert.notNull(resource, "Resource must not be null"); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index f71fe1437c..79b57cd648 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -186,7 +186,7 @@ public class SpringApplication { private static final ThreadLocal applicationHook = new ThreadLocal<>(); - private Set> primarySources; + private final Set> primarySources; private Set sources = new LinkedHashSet<>(); @@ -220,7 +220,7 @@ public class SpringApplication { private Map defaultProperties; - private List bootstrapRegistryInitializers; + private final List bootstrapRegistryInitializers; private Set additionalProfiles = Collections.emptySet(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java index e2cfe7bd2c..2677ae0edb 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java @@ -40,7 +40,7 @@ class SpringBootExceptionHandler implements UncaughtExceptionHandler { LOG_CONFIGURATION_MESSAGES = Collections.unmodifiableSet(messages); } - private static LoggedExceptionHandlerThreadLocal handler = new LoggedExceptionHandlerThreadLocal(); + private static final LoggedExceptionHandlerThreadLocal handler = new LoggedExceptionHandlerThreadLocal(); private final UncaughtExceptionHandler parent; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiBackground.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiBackground.java index e7b187b679..e1b5f91423 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiBackground.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiBackground.java @@ -59,7 +59,7 @@ public enum AnsiBackground implements AnsiElement { BRIGHT_WHITE("107"); - private String code; + private final String code; AnsiBackground(String code) { this.code = code; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java index 742f6f8f99..cf1694bcde 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java @@ -40,7 +40,7 @@ import org.springframework.util.ObjectUtils; public class ParentContextCloserApplicationListener implements ApplicationListener, ApplicationContextAware, Ordered { - private int order = Ordered.LOWEST_PRECEDENCE - 10; + private final int order = Ordered.LOWEST_PRECEDENCE - 10; private ApplicationContext context; @@ -80,7 +80,7 @@ public class ParentContextCloserApplicationListener */ protected static class ContextCloserListener implements ApplicationListener { - private WeakReference childContext; + private final WeakReference childContext; public ContextCloserListener(ConfigurableApplicationContext childContext) { this.childContext = new WeakReference<>(childContext); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java index 00ea7c3362..26889c08c5 100755 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java @@ -73,7 +73,7 @@ public class ConfigurationWarningsApplicationContextInitializer protected static final class ConfigurationWarningsPostProcessor implements PriorityOrdered, BeanDefinitionRegistryPostProcessor { - private Check[] checks; + private final Check[] checks; public ConfigurationWarningsPostProcessor(Check[] checks) { this.checks = checks; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/BoundConfigurationProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/BoundConfigurationProperties.java index fdb806123a..db0586c343 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/BoundConfigurationProperties.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/BoundConfigurationProperties.java @@ -37,7 +37,7 @@ import org.springframework.util.Assert; */ public class BoundConfigurationProperties { - private Map properties = new LinkedHashMap<>(); + private final Map properties = new LinkedHashMap<>(); /** * The bean name that this class is registered with. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java index e7b9eae2e8..392f3aacc6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java @@ -59,7 +59,7 @@ public final class ConfigurationPropertyName implements Comparable longValue; + private final Function longValue; Unit(ChronoUnit chronoUnit, String suffix, Function toUnit) { this.chronoUnit = chronoUnit; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/LenientObjectToEnumConverterFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/LenientObjectToEnumConverterFactory.java index 4a1d3e21ea..8d6a0698c0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/LenientObjectToEnumConverterFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/LenientObjectToEnumConverterFactory.java @@ -38,7 +38,7 @@ import org.springframework.util.MultiValueMap; @SuppressWarnings("rawtypes") abstract class LenientObjectToEnumConverterFactory implements ConverterFactory> { - private static Map> ALIASES; + private static final Map> ALIASES; static { MultiValueMap aliases = new LinkedMultiValueMap<>(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzer.java index 7a8a89031f..07703a1860 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzer.java @@ -87,11 +87,11 @@ class BindValidationFailureAnalyzer extends AbstractFailureAnalyzer { private static class ExceptionDetails { - private List errors; + private final List errors; - private Object target; + private final Object target; - private Throwable cause; + private final Throwable cause; ExceptionDetails(List errors, Object target, Throwable cause) { this.errors = errors; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/GsonJsonParser.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/GsonJsonParser.java index 497eadb4f5..06bd7d62ab 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/GsonJsonParser.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/GsonJsonParser.java @@ -37,7 +37,7 @@ public class GsonJsonParser extends AbstractJsonParser { private static final TypeToken LIST_TYPE = new ListTypeToken(); - private Gson gson = new GsonBuilder().create(); + private final Gson gson = new GsonBuilder().create(); @Override public Map parseMap(String json) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackConfigurator.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackConfigurator.java index be30cc7ac6..7c47a1b59c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackConfigurator.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackConfigurator.java @@ -38,7 +38,7 @@ import org.springframework.util.Assert; */ class LogbackConfigurator { - private LoggerContext context; + private final LoggerContext context; LogbackConfigurator(LoggerContext context) { Assert.notNull(context, "Context must not be null"); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java index 22ca86f40e..359ce2f73a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java @@ -76,7 +76,7 @@ import org.springframework.util.function.SingletonSupplier; */ class SpringBootJoranConfigurator extends JoranConfigurator { - private LoggingInitializationContext initializationContext; + private final LoggingInitializationContext initializationContext; SpringBootJoranConfigurator(LoggingInitializationContext initializationContext) { this.initializationContext = initializationContext; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java index 36e7ac836d..0e232d8ec5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java @@ -124,7 +124,7 @@ public class EntityManagerFactoryBuilder { */ public final class Builder { - private DataSource dataSource; + private final DataSource dataSource; private PersistenceManagedTypes managedTypes; @@ -132,7 +132,7 @@ public class EntityManagerFactoryBuilder { private String persistenceUnit; - private Map properties = new HashMap<>(); + private final Map properties = new HashMap<>(); private String[] mappingResources; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnection.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnection.java index 62f0d52ce7..85161bbfbc 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnection.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnection.java @@ -49,7 +49,7 @@ public enum EmbeddedDatabaseConnection { private final String url; - private Predicate embedded; + private final Predicate embedded; EmbeddedDatabaseConnection(String driverClassName, String url, Predicate embedded) { this.driverClassName = driverClassName; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java index ae14a41c33..3ada700326 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java @@ -48,7 +48,7 @@ public class NettyReactiveWebServerFactory extends AbstractReactiveWebServerFact private Set serverCustomizers = new LinkedHashSet<>(); - private List routeProviders = new ArrayList<>(); + private final List routeProviders = new ArrayList<>(); private Duration lifecycleTimeout; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java index 874e2ed0d8..50aef22550 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java @@ -74,7 +74,7 @@ public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFac private List contextLifecycleListeners = new ArrayList<>(); - private List serverLifecycleListeners = getDefaultServerLifecycleListeners(); + private final List serverLifecycleListeners = getDefaultServerLifecycleListeners(); private Set tomcatContextCustomizers = new LinkedHashSet<>(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java index 9420c7696d..d634a32fa9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java @@ -125,7 +125,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto private List contextLifecycleListeners = new ArrayList<>(); - private List serverLifecycleListeners = getDefaultServerLifecycleListeners(); + private final List serverLifecycleListeners = getDefaultServerLifecycleListeners(); private Set tomcatContextCustomizers = new LinkedHashSet<>(); @@ -141,7 +141,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto private Set tldSkipPatterns = new LinkedHashSet<>(TldPatterns.DEFAULT_SKIP); - private Set tldScanPatterns = new LinkedHashSet<>(TldPatterns.DEFAULT_SCAN); + private final Set tldScanPatterns = new LinkedHashSet<>(TldPatterns.DEFAULT_SCAN); private Charset uriEncoding = DEFAULT_CHARSET; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java index 371bb8c1f3..29abdb3069 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java @@ -36,7 +36,7 @@ import org.springframework.http.server.reactive.UndertowHttpHandlerAdapter; public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerFactory implements ConfigurableUndertowWebServerFactory { - private UndertowWebServerFactoryDelegate delegate = new UndertowWebServerFactoryDelegate(); + private final UndertowWebServerFactoryDelegate delegate = new UndertowWebServerFactoryDelegate(); /** * Create a new {@link UndertowReactiveWebServerFactory} instance. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java index eaeeeff5bf..96901fedce 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java @@ -94,7 +94,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac private static final Set> NO_CLASSES = Collections.emptySet(); - private UndertowWebServerFactoryDelegate delegate = new UndertowWebServerFactoryDelegate(); + private final UndertowWebServerFactoryDelegate delegate = new UndertowWebServerFactoryDelegate(); private Set deploymentInfoCustomizers = new LinkedHashSet<>(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java index accda1edaa..572b2fd12d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java @@ -81,7 +81,7 @@ class ServletComponentScanRegistrar implements ImportBeanDefinitionRegistrar { static final class ServletComponentRegisteringPostProcessorBeanDefinition extends GenericBeanDefinition { - private Set packageNames = new LinkedHashSet<>(); + private final Set packageNames = new LinkedHashSet<>(); ServletComponentRegisteringPostProcessorBeanDefinition(Collection packageNames) { setBeanClass(ServletComponentRegisteringPostProcessor.class); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java index 5cbb6640b6..285f76f053 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java @@ -73,7 +73,7 @@ public class ServletContextInitializerBeans extends AbstractCollection> initializerTypes; - private List sortedList; + private final List sortedList; @SafeVarargs @SuppressWarnings("varargs") diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilder.java index 4c6a3981fd..0d10f2a96d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilder.java @@ -509,7 +509,7 @@ public class WebServiceTemplateBuilder { private final boolean onlyAdditional; - private Set messageSenders; + private final Set messageSenders; private WebServiceMessageSenders() { this(true, Collections.emptySet()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultBootstrapContextTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultBootstrapContextTests.java index 05dff44cac..123a69b972 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultBootstrapContextTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultBootstrapContextTests.java @@ -42,11 +42,11 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; */ class DefaultBootstrapContextTests { - private DefaultBootstrapContext context = new DefaultBootstrapContext(); + private final DefaultBootstrapContext context = new DefaultBootstrapContext(); - private AtomicInteger counter = new AtomicInteger(); + private final AtomicInteger counter = new AtomicInteger(); - private StaticApplicationContext applicationContext = new StaticApplicationContext(); + private final StaticApplicationContext applicationContext = new StaticApplicationContext(); @Test void registerWhenTypeIsNullThrowsException() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java index 25880cf6be..30781cf9ac 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class AnsiPropertySourceTests { - private AnsiPropertySource source = new AnsiPropertySource("ansi", false); + private final AnsiPropertySource source = new AnsiPropertySource("ansi", false); @AfterEach void reset() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/availability/AvailabilityChangeEventTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/availability/AvailabilityChangeEventTests.java index f1527bfcbe..3bcbe70922 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/availability/AvailabilityChangeEventTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/availability/AvailabilityChangeEventTests.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock; */ class AvailabilityChangeEventTests { - private Object source = new Object(); + private final Object source = new Object(); @Test void createWhenStateIsNullThrowsException() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ContextIdApplicationContextInitializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ContextIdApplicationContextInitializerTests.java index 8b375a00a7..57f4e988c8 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ContextIdApplicationContextInitializerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ContextIdApplicationContextInitializerTests.java @@ -38,7 +38,7 @@ class ContextIdApplicationContextInitializerTests { private final ContextIdApplicationContextInitializer initializer = new ContextIdApplicationContextInitializer(); - private List contexts = new ArrayList<>(); + private final List contexts = new ArrayList<>(); @AfterEach void closeContexts() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributorsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributorsTests.java index 1e11c86e4b..6492cf335f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributorsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributorsTests.java @@ -64,9 +64,9 @@ class ConfigDataEnvironmentContributorsTests { private static final ConfigDataLocation LOCATION_2 = ConfigDataLocation.of("location2"); - private DeferredLogFactory logFactory = Supplier::get; + private final DeferredLogFactory logFactory = Supplier::get; - private DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext(); + private final DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext(); private MockEnvironment environment; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java index 96a17e4aff..6484babdc3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java @@ -886,7 +886,7 @@ class ConfigDataEnvironmentPostProcessorIntegrationTests { private final ConfigDataLocation location; - private boolean profileSpecific; + private final boolean profileSpecific; TestConfigDataResource(ConfigDataLocation location, boolean profileSpecific) { super(location.toString().contains("optionalresult")); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java index 7482cd4a83..9a4fdfaf1c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java @@ -50,9 +50,9 @@ import static org.mockito.Mockito.mock; @ExtendWith(MockitoExtension.class) class ConfigDataEnvironmentPostProcessorTests { - private StandardEnvironment environment = new StandardEnvironment(); + private final StandardEnvironment environment = new StandardEnvironment(); - private SpringApplication application = new SpringApplication(); + private final SpringApplication application = new SpringApplication(); @Mock private ConfigDataEnvironment configDataEnvironment; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentTests.java index dd452ac329..e768ce1828 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentTests.java @@ -56,15 +56,15 @@ import static org.mockito.Mockito.mock; */ class ConfigDataEnvironmentTests { - private DeferredLogFactory logFactory = Supplier::get; + private final DeferredLogFactory logFactory = Supplier::get; - private DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext(); + private final DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext(); - private MockApplicationEnvironment environment = new MockApplicationEnvironment(); + private final MockApplicationEnvironment environment = new MockApplicationEnvironment(); - private ResourceLoader resourceLoader = new DefaultResourceLoader(); + private final ResourceLoader resourceLoader = new DefaultResourceLoader(); - private Collection additionalProfiles = Collections.emptyList(); + private final Collection additionalProfiles = Collections.emptyList(); @Test void createExposesEnvironmentBinderToConfigDataLocationResolvers() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataImporterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataImporterTests.java index 73082f3f6a..1eda05408e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataImporterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataImporterTests.java @@ -44,7 +44,7 @@ import static org.mockito.BDDMockito.given; @ExtendWith(MockitoExtension.class) class ConfigDataImporterTests { - private DeferredLogFactory logFactory = Supplier::get; + private final DeferredLogFactory logFactory = Supplier::get; @Mock private ConfigDataLocationResolvers resolvers; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLoaderTests.java index 2f538516b4..8a5bedb5cb 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLoaderTests.java @@ -31,9 +31,9 @@ import static org.mockito.Mockito.mock; */ class ConfigDataLoaderTests { - private TestConfigDataLoader loader = new TestConfigDataLoader(); + private final TestConfigDataLoader loader = new TestConfigDataLoader(); - private ConfigDataLoaderContext context = mock(ConfigDataLoaderContext.class); + private final ConfigDataLoaderContext context = mock(ConfigDataLoaderContext.class); @Test void isLoadableAlwaysReturnsTrue() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLoadersTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLoadersTests.java index bc23615201..850d70b285 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLoadersTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLoadersTests.java @@ -49,11 +49,11 @@ import static org.mockito.Mockito.mock; */ class ConfigDataLoadersTests { - private DeferredLogFactory logFactory = Supplier::get; + private final DeferredLogFactory logFactory = Supplier::get; - private DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext(); + private final DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext(); - private ConfigDataLoaderContext context = mock(ConfigDataLoaderContext.class); + private final ConfigDataLoaderContext context = mock(ConfigDataLoaderContext.class); @TempDir private File tempDir; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationNotFoundExceptionTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationNotFoundExceptionTests.java index ff1ffbcd01..26e10270cd 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationNotFoundExceptionTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationNotFoundExceptionTests.java @@ -31,7 +31,7 @@ import static org.mockito.Mockito.mock; */ class ConfigDataLocationNotFoundExceptionTests { - private Origin origin = mock(Origin.class); + private final Origin origin = mock(Origin.class); private final ConfigDataLocation location = ConfigDataLocation.of("optional:test").withOrigin(this.origin); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationResolverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationResolverTests.java index 0c839e06d6..ceac757198 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationResolverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationResolverTests.java @@ -31,9 +31,9 @@ import static org.mockito.Mockito.mock; */ class ConfigDataLocationResolverTests { - private ConfigDataLocationResolver resolver = new TestConfigDataLocationResolver(); + private final ConfigDataLocationResolver resolver = new TestConfigDataLocationResolver(); - private ConfigDataLocationResolverContext context = mock(ConfigDataLocationResolverContext.class); + private final ConfigDataLocationResolverContext context = mock(ConfigDataLocationResolverContext.class); @Test void resolveProfileSpecificReturnsEmptyList() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationResolversTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationResolversTests.java index 624136c491..ddef7ae332 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationResolversTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationResolversTests.java @@ -51,9 +51,9 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @ExtendWith(MockitoExtension.class) class ConfigDataLocationResolversTests { - private DeferredLogFactory logFactory = Supplier::get; + private final DeferredLogFactory logFactory = Supplier::get; - private DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext(); + private final DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext(); @Mock private Binder binder; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataResourceNotFoundExceptionTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataResourceNotFoundExceptionTests.java index 14cb46447c..5b907b7fbd 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataResourceNotFoundExceptionTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataResourceNotFoundExceptionTests.java @@ -38,11 +38,11 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ class ConfigDataResourceNotFoundExceptionTests { - private ConfigDataResource resource = new TestConfigDataResource(); + private final ConfigDataResource resource = new TestConfigDataResource(); - private ConfigDataLocation location = ConfigDataLocation.of("optional:test"); + private final ConfigDataLocation location = ConfigDataLocation.of("optional:test"); - private Throwable cause = new RuntimeException(); + private final Throwable cause = new RuntimeException(); private File exists; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigTreeConfigDataLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigTreeConfigDataLoaderTests.java index 81821653af..85a2134ee2 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigTreeConfigDataLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigTreeConfigDataLoaderTests.java @@ -39,9 +39,9 @@ import static org.mockito.Mockito.mock; */ class ConfigTreeConfigDataLoaderTests { - private ConfigTreeConfigDataLoader loader = new ConfigTreeConfigDataLoader(); + private final ConfigTreeConfigDataLoader loader = new ConfigTreeConfigDataLoader(); - private ConfigDataLoaderContext loaderContext = mock(ConfigDataLoaderContext.class); + private final ConfigDataLoaderContext loaderContext = mock(ConfigDataLoaderContext.class); @TempDir Path directory; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigTreeConfigDataLocationResolverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigTreeConfigDataLocationResolverTests.java index 206c76d0c2..a4db4c40d0 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigTreeConfigDataLocationResolverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigTreeConfigDataLocationResolverTests.java @@ -36,10 +36,10 @@ import static org.mockito.Mockito.mock; */ class ConfigTreeConfigDataLocationResolverTests { - private ConfigTreeConfigDataLocationResolver resolver = new ConfigTreeConfigDataLocationResolver( + private final ConfigTreeConfigDataLocationResolver resolver = new ConfigTreeConfigDataLocationResolver( new DefaultResourceLoader()); - private ConfigDataLocationResolverContext context = mock(ConfigDataLocationResolverContext.class); + private final ConfigDataLocationResolverContext context = mock(ConfigDataLocationResolverContext.class); @TempDir File temp; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/InactiveConfigDataAccessExceptionTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/InactiveConfigDataAccessExceptionTests.java index 8332a7b4f8..2e70f9f356 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/InactiveConfigDataAccessExceptionTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/InactiveConfigDataAccessExceptionTests.java @@ -38,13 +38,13 @@ import static org.mockito.Mockito.mock; */ class InactiveConfigDataAccessExceptionTests { - private MockPropertySource propertySource = new MockPropertySource(); + private final MockPropertySource propertySource = new MockPropertySource(); - private ConfigDataResource resource = new TestConfigDataResource(); + private final ConfigDataResource resource = new TestConfigDataResource(); - private String propertyName = "spring"; + private final String propertyName = "spring"; - private Origin origin = new PropertySourceOrigin(this.propertySource, this.propertyName); + private final Origin origin = new PropertySourceOrigin(this.propertySource, this.propertyName); @Test void createHasCorrectMessage() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/InvalidConfigDataPropertyExceptionTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/InvalidConfigDataPropertyExceptionTests.java index e47abe01d3..0a86faca1e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/InvalidConfigDataPropertyExceptionTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/InvalidConfigDataPropertyExceptionTests.java @@ -37,13 +37,14 @@ import static org.assertj.core.api.Assertions.assertThatNoException; */ class InvalidConfigDataPropertyExceptionTests { - private ConfigDataResource resource = new TestConfigDataResource(); + private final ConfigDataResource resource = new TestConfigDataResource(); - private ConfigurationPropertyName replacement = ConfigurationPropertyName.of("replacement"); + private final ConfigurationPropertyName replacement = ConfigurationPropertyName.of("replacement"); - private ConfigurationPropertyName invalid = ConfigurationPropertyName.of("invalid"); + private final ConfigurationPropertyName invalid = ConfigurationPropertyName.of("invalid"); - private ConfigurationProperty property = new ConfigurationProperty(this.invalid, "bad", MockOrigin.of("origin")); + private final ConfigurationProperty property = new ConfigurationProperty(this.invalid, "bad", + MockOrigin.of("origin")); @Test void createHasCorrectMessage() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/LocationResourceLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/LocationResourceLoaderTests.java index f93c734e6a..f2ebd4c55b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/LocationResourceLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/LocationResourceLoaderTests.java @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; */ class LocationResourceLoaderTests { - private LocationResourceLoader loader = new LocationResourceLoader(new DefaultResourceLoader()); + private final LocationResourceLoader loader = new LocationResourceLoader(new DefaultResourceLoader()); @TempDir File temp; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLoaderTests.java index 3287efaf3e..fc25f61dc4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLoaderTests.java @@ -36,9 +36,9 @@ import static org.mockito.Mockito.mock; */ class StandardConfigDataLoaderTests { - private StandardConfigDataLoader loader = new StandardConfigDataLoader(); + private final StandardConfigDataLoader loader = new StandardConfigDataLoader(); - private ConfigDataLoaderContext loaderContext = mock(ConfigDataLoaderContext.class); + private final ConfigDataLoaderContext loaderContext = mock(ConfigDataLoaderContext.class); @Test void loadWhenLocationResultsInMultiplePropertySourcesAddsAllToConfigData() throws IOException { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java index a9f61afaa9..bb78061bc2 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java @@ -48,13 +48,13 @@ class StandardConfigDataLocationResolverTests { private StandardConfigDataLocationResolver resolver; - private ConfigDataLocationResolverContext context = mock(ConfigDataLocationResolverContext.class); + private final ConfigDataLocationResolverContext context = mock(ConfigDataLocationResolverContext.class); private MockEnvironment environment; private Binder environmentBinder; - private ResourceLoader resourceLoader = new DefaultResourceLoader(); + private final ResourceLoader resourceLoader = new DefaultResourceLoader(); @BeforeEach void setup() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/event/EventPublishingRunListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/event/EventPublishingRunListenerTests.java index f9f1e639df..99e2cad3df 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/event/EventPublishingRunListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/event/EventPublishingRunListenerTests.java @@ -86,7 +86,7 @@ class EventPublishingRunListenerTests { static class TestApplicationListener implements ApplicationListener { - private Deque events = new ArrayDeque<>(); + private final Deque events = new ArrayDeque<>(); @Override public void onApplicationEvent(ApplicationEvent event) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanFactoryInitializationAotProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanFactoryInitializationAotProcessorTests.java index b0e8ad3b7d..9029dc4959 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanFactoryInitializationAotProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanFactoryInitializationAotProcessorTests.java @@ -430,7 +430,7 @@ class ConfigurationPropertiesBeanFactoryInitializationAotProcessorTests { public static class SampleImmutablePropertiesWithRecursive { @NestedConfigurationProperty - private ImmutableRecursive recursive; + private final ImmutableRecursive recursive; SampleImmutablePropertiesWithRecursive(ImmutableRecursive recursive) { this.recursive = recursive; @@ -519,7 +519,7 @@ class ConfigurationPropertiesBeanFactoryInitializationAotProcessorTests { public static class ImmutableRecursive { @SuppressWarnings("unused") - private ImmutableRecursive recursive; + private final ImmutableRecursive recursive; ImmutableRecursive(ImmutableRecursive recursive) { this.recursive = recursive; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanRegistrarTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanRegistrarTests.java index 290315ca3d..631727fae5 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanRegistrarTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanRegistrarTests.java @@ -39,9 +39,10 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; */ class ConfigurationPropertiesBeanRegistrarTests { - private BeanDefinitionRegistry registry = new DefaultListableBeanFactory(); + private final BeanDefinitionRegistry registry = new DefaultListableBeanFactory(); - private ConfigurationPropertiesBeanRegistrar registrar = new ConfigurationPropertiesBeanRegistrar(this.registry); + private final ConfigurationPropertiesBeanRegistrar registrar = new ConfigurationPropertiesBeanRegistrar( + this.registry); @Test void registerWhenNotAlreadyRegisteredAddBeanDefinition() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindHandlerAdvisorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindHandlerAdvisorTests.java index 1ac12648d4..a7e0762e28 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindHandlerAdvisorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindHandlerAdvisorTests.java @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class ConfigurationPropertiesBindHandlerAdvisorTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @AfterEach void cleanup() { @@ -151,7 +151,7 @@ class ConfigurationPropertiesBindHandlerAdvisorTests { @ConfigurationProperties("foo.bar") static class BindingServiceProperties { - private Map bindings = new TreeMap<>(); + private final Map bindings = new TreeMap<>(); Map getBindings() { return this.bindings; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java index f4077af3c7..4423341991 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java @@ -1703,7 +1703,7 @@ class ConfigurationPropertiesTests { static class ValidatedValidNestedJsr303Properties { @Valid - private List properties = Collections.singletonList(new Jsr303Properties()); + private final List properties = Collections.singletonList(new Jsr303Properties()); List getProperties() { return this.properties; @@ -1997,7 +1997,7 @@ class ConfigurationPropertiesTests { @ConfigurationProperties(prefix = "sample") static class MapWithNumericKeyProperties { - private Map properties = new LinkedHashMap<>(); + private final Map properties = new LinkedHashMap<>(); Map getProperties() { return this.properties; @@ -2575,7 +2575,7 @@ class ConfigurationPropertiesTests { static class Nested { - private int age; + private final int age; @Autowired Nested(int age) { @@ -2592,7 +2592,7 @@ class ConfigurationPropertiesTests { static class Outer { - private int age; + private final int age; Outer(int age) { this.age = age; @@ -2617,7 +2617,7 @@ class ConfigurationPropertiesTests { @ConfigurationProperties("test") static class MultiConstructorConfigurationListProperties { - private List nested = new ArrayList<>(); + private final List nested = new ArrayList<>(); List getNested() { return this.nested; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/PropertyMapperTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/PropertyMapperTests.java index 3651bbe0a5..852bbe8483 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/PropertyMapperTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/PropertyMapperTests.java @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ class PropertyMapperTests { - private PropertyMapper map = PropertyMapper.get(); + private final PropertyMapper map = PropertyMapper.get(); @Test void fromNullValue() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java index 9b4d01fe7b..6b6ca99da3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java @@ -52,7 +52,7 @@ class ArrayBinderTests { private static final Bindable INTEGER_ARRAY = Bindable.of(Integer[].class); - private List sources = new ArrayList<>(); + private final List sources = new ArrayList<>(); private final Binder binder = new Binder(this.sources); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrarTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrarTests.java index f8f6c0884c..11115bf7f4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrarTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrarTests.java @@ -412,7 +412,7 @@ class BindableRuntimeHintsRegistrarTests { public static class ImmutableWithRecursive { @NestedConfigurationProperty - private ImmutableRecursive recursive; + private final ImmutableRecursive recursive; ImmutableWithRecursive(ImmutableRecursive recursive) { this.recursive = recursive; @@ -500,7 +500,7 @@ class BindableRuntimeHintsRegistrarTests { public static class ImmutableRecursive { @SuppressWarnings("unused") - private ImmutableRecursive recursive; + private final ImmutableRecursive recursive; ImmutableRecursive(ImmutableRecursive recursive) { this.recursive = recursive; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java index 7a2c253e0f..42a0654352 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java @@ -372,7 +372,7 @@ class BinderTests { private String value; - private List items = Collections.emptyList(); + private final List items = Collections.emptyList(); String getValue() { return this.value; @@ -406,7 +406,7 @@ class BinderTests { private String value = "hello"; - private List items = Collections.emptyList(); + private final List items = Collections.emptyList(); String getValue() { return this.value; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BoundPropertiesTrackingBindHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BoundPropertiesTrackingBindHandlerTests.java index 93116d2af3..847dd4dfec 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BoundPropertiesTrackingBindHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BoundPropertiesTrackingBindHandlerTests.java @@ -42,7 +42,7 @@ import static org.mockito.Mockito.never; @ExtendWith(MockitoExtension.class) class BoundPropertiesTrackingBindHandlerTests { - private List sources = new ArrayList<>(); + private final List sources = new ArrayList<>(); private BoundPropertiesTrackingBindHandler handler; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java index 1c9c2f4da4..285bd661b7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java @@ -430,7 +430,7 @@ class CollectionBinderTests { static class ExampleCollectionBean { - private List items = new ArrayList<>(); + private final List items = new ArrayList<>(); private Set itemsSet = new LinkedHashSet<>(); @@ -477,7 +477,7 @@ class CollectionBinderTests { static class ExampleCustomWithDefaultConstructorBean { - private MyCustomWithDefaultConstructorList items = new MyCustomWithDefaultConstructorList(); + private final MyCustomWithDefaultConstructorList items = new MyCustomWithDefaultConstructorList(); MyCustomWithDefaultConstructorList getItems() { return this.items; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProviderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProviderTests.java index 7bd7121b34..118ce6105a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProviderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProviderTests.java @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; */ class DefaultBindConstructorProviderTests { - private DefaultBindConstructorProvider provider = new DefaultBindConstructorProvider(); + private final DefaultBindConstructorProvider provider = new DefaultBindConstructorProvider(); @Test void getBindConstructorWhenHasOnlyDefaultConstructorReturnsNull() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java index 9ead5a9403..007415c30d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java @@ -724,7 +724,7 @@ class JavaBeanBinderTests { static class ExampleMapBeanWithoutSetter { - private Map map = new LinkedHashMap<>(); + private final Map map = new LinkedHashMap<>(); Map getMap() { return this.map; @@ -734,7 +734,7 @@ class JavaBeanBinderTests { static class ExampleListBeanWithoutSetter { - private List list = new ArrayList<>(); + private final List list = new ArrayList<>(); List getList() { return this.list; @@ -744,7 +744,7 @@ class JavaBeanBinderTests { static class ExampleSetBeanWithoutSetter { - private Set set = new LinkedHashSet<>(); + private final Set set = new LinkedHashSet<>(); Set getSet() { return this.set; @@ -754,7 +754,7 @@ class JavaBeanBinderTests { static class ExampleCollectionBeanWithoutSetter { - private Collection collection = new ArrayList<>(); + private final Collection collection = new ArrayList<>(); Collection getCollection() { return this.collection; @@ -793,7 +793,7 @@ class JavaBeanBinderTests { static class ExampleNestedBeanWithoutSetter { - private ExampleValueBean valueBean = new ExampleValueBean(); + private final ExampleValueBean valueBean = new ExampleValueBean(); ExampleValueBean getValueBean() { return this.valueBean; @@ -803,7 +803,7 @@ class JavaBeanBinderTests { static class ExampleNestedBeanWithoutSetterOrType { - private ExampleValueBean valueBean = new ExampleValueBean(); + private final ExampleValueBean valueBean = new ExampleValueBean(); Object getValueBean() { return this.valueBean; @@ -813,7 +813,7 @@ class JavaBeanBinderTests { static class ExampleImmutableNestedBeanWithoutSetter { - private NestedImmutable nested = new NestedImmutable(); + private final NestedImmutable nested = new NestedImmutable(); NestedImmutable getNested() { return this.nested; @@ -1143,7 +1143,7 @@ class JavaBeanBinderTests { static class JavaBeanWithGetIs { - private List names = new ArrayList<>(); + private final List names = new ArrayList<>(); boolean isNames() { return !this.names.isEmpty(); @@ -1220,7 +1220,7 @@ class JavaBeanBinderTests { static class BridgeType extends BridgeBaseType { - private String value; + private final String value; BridgeType(String value) { this.value = value; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java index fc41f4d91c..7f0118c4b1 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java @@ -647,7 +647,7 @@ class MapBinderTests { static class NestableFoo { - private Map foos = new LinkedHashMap<>(); + private final Map foos = new LinkedHashMap<>(); private String value; @@ -699,7 +699,7 @@ class MapBinderTests { static class ExampleCustomWithDefaultConstructorBean { - private MyCustomWithDefaultConstructorMap items = new MyCustomWithDefaultConstructorMap(); + private final MyCustomWithDefaultConstructorMap items = new MyCustomWithDefaultConstructorMap(); MyCustomWithDefaultConstructorMap getItems() { return this.items; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java index 2873bc4438..bafa5ad615 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java @@ -775,7 +775,7 @@ class ValueObjectBinderTests { static class NestedConstructorBeanWithEmptyDefaultValueForEnumTypes { - private Foo foo; + private final Foo foo; NestedConstructorBeanWithEmptyDefaultValueForEnumTypes(@DefaultValue Foo foo) { this.foo = foo; @@ -795,7 +795,7 @@ class ValueObjectBinderTests { static class NestedConstructorBeanWithEmptyDefaultValueForPrimitiveTypes { - private int intValue; + private final int intValue; NestedConstructorBeanWithEmptyDefaultValueForPrimitiveTypes(@DefaultValue int intValue) { this.intValue = intValue; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandlerTests.java index df9c908ef9..2f9cf36802 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandlerTests.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; */ class IgnoreErrorsBindHandlerTests { - private List sources = new ArrayList<>(); + private final List sources = new ArrayList<>(); private Binder binder; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreTopLevelConverterNotFoundBindHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreTopLevelConverterNotFoundBindHandlerTests.java index d557c416b1..ae1ce3b79b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreTopLevelConverterNotFoundBindHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreTopLevelConverterNotFoundBindHandlerTests.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; */ class IgnoreTopLevelConverterNotFoundBindHandlerTests { - private List sources = new ArrayList<>(); + private final List sources = new ArrayList<>(); private Binder binder; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandlerTests.java index f10e46b2cd..516132b74a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandlerTests.java @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; */ class NoUnboundElementsBindHandlerTests { - private List sources = new ArrayList<>(); + private final List sources = new ArrayList<>(); private Binder binder; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/PackagePrivateBeanBindingTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/PackagePrivateBeanBindingTests.java index cec4eec197..b7298c3c02 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/PackagePrivateBeanBindingTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/PackagePrivateBeanBindingTests.java @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class PackagePrivateBeanBindingTests { - private List sources = new ArrayList<>(); + private final List sources = new ArrayList<>(); private Binder binder; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java index a2a4b1f37b..a7b9a3596a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java @@ -60,7 +60,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; */ class ValidationBindHandlerTests { - private List sources = new ArrayList<>(); + private final List sources = new ArrayList<>(); private ValidationBindHandler handler; @@ -380,7 +380,7 @@ class ValidationBindHandlerTests { static class ExampleCamelCase { @Valid - private InnerProperties inner = new InnerProperties(); + private final InnerProperties inner = new InnerProperties(); InnerProperties getInner() { return this.inner; @@ -414,7 +414,7 @@ class ValidationBindHandlerTests { static class ExampleWithMap { - private Map items = new LinkedHashMap<>(); + private final Map items = new LinkedHashMap<>(); Map getItems() { return this.items; @@ -438,7 +438,7 @@ class ValidationBindHandlerTests { static class TestHandler extends AbstractBindHandler { - private Object result; + private final Object result; TestHandler(Object result) { this.result = result; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySourceTests.java index 6378f43322..d2377ac699 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySourceTests.java @@ -31,9 +31,9 @@ import static org.assertj.core.api.Assertions.assertThat; */ class ConfigurationPropertySourcesPropertySourceTests { - private List configurationSources = new ArrayList<>(); + private final List configurationSources = new ArrayList<>(); - private ConfigurationPropertySourcesPropertySource propertySource = new ConfigurationPropertySourcesPropertySource( + private final ConfigurationPropertySourcesPropertySource propertySource = new ConfigurationPropertySourcesPropertySource( "test", this.configurationSources); @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyTests.java index aaee7ba44b..a6237cd01d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyTests.java @@ -36,7 +36,7 @@ class ConfigurationPropertyTests { private static final ConfigurationPropertyName NAME = ConfigurationPropertyName.of("foo"); - private ConfigurationPropertySource source = ConfigurationPropertySource.from(mock(PropertySource.class)); + private final ConfigurationPropertySource source = ConfigurationPropertySource.from(mock(PropertySource.class)); @Test void createWhenNameIsNullShouldThrowException() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SoftReferenceConfigurationPropertyCacheTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SoftReferenceConfigurationPropertyCacheTests.java index 7eb604bef8..93dab242d1 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SoftReferenceConfigurationPropertyCacheTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SoftReferenceConfigurationPropertyCacheTests.java @@ -37,7 +37,7 @@ class SoftReferenceConfigurationPropertyCacheTests { private Clock clock = FIXED_CLOCK; - private AtomicInteger createCount = new AtomicInteger(); + private final AtomicInteger createCount = new AtomicInteger(); private TestSoftReferenceConfigurationPropertyCache cache = new TestSoftReferenceConfigurationPropertyCache(false); @@ -152,7 +152,7 @@ class SoftReferenceConfigurationPropertyCacheTests { private final int createCount; - private int refreshCount; + private final int refreshCount; Value(int createCount, int refreshCount) { this.createCount = createCount; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/TestPropertyMapper.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/TestPropertyMapper.java index 3bf41d636d..191f863b48 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/TestPropertyMapper.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/TestPropertyMapper.java @@ -29,9 +29,9 @@ import org.springframework.util.MultiValueMap; */ class TestPropertyMapper implements PropertyMapper { - private MultiValueMap fromConfig = new LinkedMultiValueMap<>(); + private final MultiValueMap fromConfig = new LinkedMultiValueMap<>(); - private Map fromSource = new LinkedHashMap<>(); + private final Map fromSource = new LinkedHashMap<>(); void addFromPropertySource(String from, String to) { this.fromSource.put(from, ConfigurationPropertyName.of(to)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/ApplicationConversionServiceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/ApplicationConversionServiceTests.java index 5fe5d23261..ff03e03bdd 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/ApplicationConversionServiceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/ApplicationConversionServiceTests.java @@ -46,7 +46,7 @@ import static org.mockito.Mockito.mock; */ class ApplicationConversionServiceTests { - private FormatterRegistry registry = mock(FormatterRegistry.class); + private final FormatterRegistry registry = mock(FormatterRegistry.class); @Test void addBeansWhenHasGenericConverterBeanAddConverter() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyNameFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyNameFailureAnalyzerTests.java index 0bf0eb14bd..4dfb0afa81 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyNameFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyNameFailureAnalyzerTests.java @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class InvalidConfigurationPropertyNameFailureAnalyzerTests { - private InvalidConfigurationPropertyNameFailureAnalyzer analyzer = new InvalidConfigurationPropertyNameFailureAnalyzer(); + private final InvalidConfigurationPropertyNameFailureAnalyzer analyzer = new InvalidConfigurationPropertyNameFailureAnalyzer(); @Test void analysisWhenRootCauseIsBeanCreationFailureShouldContainBeanName() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/PatternParseFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/PatternParseFailureAnalyzerTests.java index 8bcdd0e512..6cdc9c9dd7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/PatternParseFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/PatternParseFailureAnalyzerTests.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class PatternParseFailureAnalyzerTests { - private PathPatternParser parser = new PathPatternParser(); + private final PathPatternParser parser = new PathPatternParser(); @Test void patternParseFailureQuotesPattern() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/EnvironmentPostProcessorApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/EnvironmentPostProcessorApplicationListenerTests.java index ef21aea8da..47b15d2d03 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/EnvironmentPostProcessorApplicationListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/EnvironmentPostProcessorApplicationListenerTests.java @@ -48,11 +48,11 @@ import static org.mockito.Mockito.spy; */ class EnvironmentPostProcessorApplicationListenerTests { - private DeferredLogs deferredLogs = spy(new DeferredLogs()); + private final DeferredLogs deferredLogs = spy(new DeferredLogs()); - private DefaultBootstrapContext bootstrapContext = spy(new DefaultBootstrapContext()); + private final DefaultBootstrapContext bootstrapContext = spy(new DefaultBootstrapContext()); - private EnvironmentPostProcessorApplicationListener listener = new EnvironmentPostProcessorApplicationListener(); + private final EnvironmentPostProcessorApplicationListener listener = new EnvironmentPostProcessorApplicationListener(); @BeforeEach void setup() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/NoSnakeYamlPropertySourceLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/NoSnakeYamlPropertySourceLoaderTests.java index 4192448c46..425da5596a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/NoSnakeYamlPropertySourceLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/NoSnakeYamlPropertySourceLoaderTests.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; @ClassPathExclusions("snakeyaml-*.jar") class NoSnakeYamlPropertySourceLoaderTests { - private YamlPropertySourceLoader loader = new YamlPropertySourceLoader(); + private final YamlPropertySourceLoader loader = new YamlPropertySourceLoader(); @Test void load() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedMapPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedMapPropertySourceTests.java index af862453b4..45a16e4e4e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedMapPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedMapPropertySourceTests.java @@ -35,11 +35,11 @@ import static org.mockito.Mockito.mock; */ class OriginTrackedMapPropertySourceTests { - private Map map = new LinkedHashMap<>(); + private final Map map = new LinkedHashMap<>(); - private OriginTrackedMapPropertySource source = new OriginTrackedMapPropertySource("test", this.map); + private final OriginTrackedMapPropertySource source = new OriginTrackedMapPropertySource("test", this.map); - private Origin origin = mock(Origin.class); + private final Origin origin = mock(Origin.class); @Test void getPropertyWhenMissingShouldReturnNull() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java index a51ce2f1a3..19d892de18 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class PropertiesPropertySourceLoaderTests { - private PropertiesPropertySourceLoader loader = new PropertiesPropertySourceLoader(); + private final PropertiesPropertySourceLoader loader = new PropertiesPropertySourceLoader(); @Test void getFileExtensions() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/RandomValuePropertySourceEnvironmentPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/RandomValuePropertySourceEnvironmentPostProcessorTests.java index f90a20c2c1..711023d920 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/RandomValuePropertySourceEnvironmentPostProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/RandomValuePropertySourceEnvironmentPostProcessorTests.java @@ -34,7 +34,7 @@ import static org.mockito.Mockito.mock; */ class RandomValuePropertySourceEnvironmentPostProcessorTests { - private RandomValuePropertySourceEnvironmentPostProcessor postProcessor = new RandomValuePropertySourceEnvironmentPostProcessor( + private final RandomValuePropertySourceEnvironmentPostProcessor postProcessor = new RandomValuePropertySourceEnvironmentPostProcessor( Supplier::get); @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/RandomValuePropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/RandomValuePropertySourceTests.java index 9df913875c..f0f384976b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/RandomValuePropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/RandomValuePropertySourceTests.java @@ -40,7 +40,7 @@ import static org.mockito.Mockito.spy; */ class RandomValuePropertySourceTests { - private RandomValuePropertySource source = new RandomValuePropertySource(); + private final RandomValuePropertySource source = new RandomValuePropertySource(); @Test void getPropertyWhenNotRandomReturnsNull() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/ReflectionEnvironmentPostProcessorsFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/ReflectionEnvironmentPostProcessorsFactoryTests.java index 982224626f..1343cdb11e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/ReflectionEnvironmentPostProcessorsFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/ReflectionEnvironmentPostProcessorsFactoryTests.java @@ -125,7 +125,7 @@ class ReflectionEnvironmentPostProcessorsFactoryTests { class EnvironmentPostProcessorsFactoryAssert { - private EnvironmentPostProcessorsFactory factory; + private final EnvironmentPostProcessorsFactory factory; EnvironmentPostProcessorsFactoryAssert(EnvironmentPostProcessorsFactory factory) { this.factory = factory; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessorTests.java index 0f9178d357..1198b4075f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessorTests.java @@ -44,9 +44,9 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; */ class SpringApplicationJsonEnvironmentPostProcessorTests { - private SpringApplicationJsonEnvironmentPostProcessor processor = new SpringApplicationJsonEnvironmentPostProcessor(); + private final SpringApplicationJsonEnvironmentPostProcessor processor = new SpringApplicationJsonEnvironmentPostProcessor(); - private ConfigurableEnvironment environment = new StandardEnvironment(); + private final ConfigurableEnvironment environment = new StandardEnvironment(); @Test void error() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java index 16d10379a4..814d6b2ae2 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class YamlPropertySourceLoaderTests { - private YamlPropertySourceLoader loader = new YamlPropertySourceLoader(); + private final YamlPropertySourceLoader loader = new YamlPropertySourceLoader(); @Test void load() throws Exception { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java index b680ce4310..776474c46e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java @@ -45,7 +45,7 @@ import static org.mockito.Mockito.mock; */ class JsonObjectDeserializerTests { - private TestJsonObjectDeserializer testDeserializer = new TestJsonObjectDeserializer<>(); + private final TestJsonObjectDeserializer testDeserializer = new TestJsonObjectDeserializer<>(); @Test void deserializeObjectShouldReadJson() throws Exception { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogFactoryTests.java index dcba31b1db..30104a86f3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogFactoryTests.java @@ -29,7 +29,7 @@ import static org.mockito.Mockito.mock; */ class DeferredLogFactoryTests { - private DeferredLogFactory factory = (supplier) -> this.log = supplier.get(); + private final DeferredLogFactory factory = (supplier) -> this.log = supplier.get(); private Log log; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogTests.java index c887824089..e0f472355a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogTests.java @@ -33,13 +33,13 @@ import static org.mockito.Mockito.mock; */ class DeferredLogTests { - private DeferredLog deferredLog = new DeferredLog(); + private final DeferredLog deferredLog = new DeferredLog(); - private Object message = "Message"; + private final Object message = "Message"; - private Throwable throwable = new IllegalStateException(); + private final Throwable throwable = new IllegalStateException(); - private Log log = mock(Log.class); + private final Log log = mock(Log.class); @Test void isTraceEnabled() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DelegatingLoggingSystemFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DelegatingLoggingSystemFactoryTests.java index 86f4d028dc..aea0e6e5c7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DelegatingLoggingSystemFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DelegatingLoggingSystemFactoryTests.java @@ -33,7 +33,7 @@ import static org.mockito.Mockito.mock; */ class DelegatingLoggingSystemFactoryTests { - private ClassLoader classLoader = getClass().getClassLoader(); + private final ClassLoader classLoader = getClass().getClassLoader(); @Test void getLoggingSystemWhenDelegatesFunctionIsNullReturnsNull() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/sql/init/dependency/DatabaseInitializationDependencyConfigurerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/sql/init/dependency/DatabaseInitializationDependencyConfigurerTests.java index 9b6eb15ad0..857fe8a15b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/sql/init/dependency/DatabaseInitializationDependencyConfigurerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/sql/init/dependency/DatabaseInitializationDependencyConfigurerTests.java @@ -248,7 +248,7 @@ class DatabaseInitializationDependencyConfigurerTests { static class MockDatabaseInitializerDetector implements DatabaseInitializerDetector { - private static DatabaseInitializerDetector instance = mock(DatabaseInitializerDetector.class); + private static final DatabaseInitializerDetector instance = mock(DatabaseInitializerDetector.class); @Override public Set detect(ConfigurableListableBeanFactory beanFactory) { @@ -265,7 +265,7 @@ class DatabaseInitializationDependencyConfigurerTests { static class OrderedLowestMockDatabaseInitializerDetector implements DatabaseInitializerDetector { - private static DatabaseInitializerDetector instance = mock(DatabaseInitializerDetector.class); + private static final DatabaseInitializerDetector instance = mock(DatabaseInitializerDetector.class); @Override public Set detect(ConfigurableListableBeanFactory beanFactory) { @@ -281,7 +281,7 @@ class DatabaseInitializationDependencyConfigurerTests { static class OrderedNearLowestMockDatabaseInitializerDetector implements DatabaseInitializerDetector { - private static DatabaseInitializerDetector instance = mock(DatabaseInitializerDetector.class); + private static final DatabaseInitializerDetector instance = mock(DatabaseInitializerDetector.class); @Override public Set detect(ConfigurableListableBeanFactory beanFactory) { @@ -297,7 +297,7 @@ class DatabaseInitializationDependencyConfigurerTests { static class MockedDependsOnDatabaseInitializationDetector implements DependsOnDatabaseInitializationDetector { - private static DependsOnDatabaseInitializationDetector instance = mock( + private static final DependsOnDatabaseInitializationDetector instance = mock( DependsOnDatabaseInitializationDetector.class); @Override diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java index 183a491934..c06ded413d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java @@ -39,7 +39,7 @@ import static org.mockito.Mockito.spy; */ class TaskExecutorBuilderTests { - private TaskExecutorBuilder builder = new TaskExecutorBuilder(); + private final TaskExecutorBuilder builder = new TaskExecutorBuilder(); @Test void poolSettingsShouldApply() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskSchedulerBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskSchedulerBuilderTests.java index b9f8786f43..c7cd82ac53 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskSchedulerBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskSchedulerBuilderTests.java @@ -37,7 +37,7 @@ import static org.mockito.Mockito.spy; */ class TaskSchedulerBuilderTests { - private TaskSchedulerBuilder builder = new TaskSchedulerBuilder(); + private final TaskSchedulerBuilder builder = new TaskSchedulerBuilder(); @Test void poolSettingsShouldApply() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/util/InstantiatorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/util/InstantiatorTests.java index 25c6f944b7..a43675e11f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/util/InstantiatorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/util/InstantiatorTests.java @@ -166,7 +166,7 @@ class InstantiatorTests { static class WithFactory { - private ParamC paramC; + private final ParamC paramC; WithFactory(ParamC paramC) { this.paramC = paramC; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java index 47f29318e2..8b2e706317 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java @@ -75,7 +75,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat @ExtendWith(MockitoExtension.class) class RestTemplateBuilderTests { - private RestTemplateBuilder builder = new RestTemplateBuilder(); + private final RestTemplateBuilder builder = new RestTemplateBuilder(); @Mock private HttpMessageConverter messageConverter; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/FileSessionPersistenceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/FileSessionPersistenceTests.java index 53a4ba7bbc..358a6adf12 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/FileSessionPersistenceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/FileSessionPersistenceTests.java @@ -39,9 +39,9 @@ class FileSessionPersistenceTests { private FileSessionPersistence persistence; - private ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + private final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - private Date expiration = new Date(System.currentTimeMillis() + 10000); + private final Date expiration = new Date(System.currentTimeMillis() + 10000); @BeforeEach void setup(@TempDir File tempDir) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java index f869a62d77..8f93c71d5d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java @@ -50,7 +50,7 @@ import static org.mockito.BDDMockito.then; */ class ReactiveWebServerApplicationContextTests { - private ReactiveWebServerApplicationContext context = new ReactiveWebServerApplicationContext(); + private final ReactiveWebServerApplicationContext context = new ReactiveWebServerApplicationContext(); @AfterEach void cleanUp() { @@ -183,7 +183,7 @@ class ReactiveWebServerApplicationContextTests { static class TestApplicationListener implements ApplicationListener { - private Deque events = new ArrayDeque<>(); + private final Deque events = new ArrayDeque<>(); @Override public void onApplicationEvent(ApplicationEvent event) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java index bfecd40007..4c76b6dd62 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java @@ -34,7 +34,7 @@ class MustacheViewResolverTests { private final String prefix = "classpath:/" + getClass().getPackage().getName().replace(".", "/") + "/"; - private MustacheViewResolver resolver = new MustacheViewResolver(); + private final MustacheViewResolver resolver = new MustacheViewResolver(); @BeforeEach void init() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerFactoryCustomizerBeanPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerFactoryCustomizerBeanPostProcessorTests.java index eb0adb7233..229f240f55 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerFactoryCustomizerBeanPostProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerFactoryCustomizerBeanPostProcessorTests.java @@ -43,7 +43,7 @@ import static org.mockito.Mockito.mock; @ExtendWith(MockitoExtension.class) class WebServerFactoryCustomizerBeanPostProcessorTests { - private WebServerFactoryCustomizerBeanPostProcessor processor = new WebServerFactoryCustomizerBeanPostProcessor(); + private final WebServerFactoryCustomizerBeanPostProcessor processor = new WebServerFactoryCustomizerBeanPostProcessor(); @Mock private ListableBeanFactory beanFactory; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java index e0a18eae52..25e6ded7c0 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java @@ -43,9 +43,9 @@ import static org.mockito.ArgumentMatchers.isA; */ class DelegatingFilterProxyRegistrationBeanTests extends AbstractFilterRegistrationBeanTests { - private static ThreadLocal mockFilterInitialized = new ThreadLocal<>(); + private static final ThreadLocal mockFilterInitialized = new ThreadLocal<>(); - private GenericWebApplicationContext applicationContext = new GenericWebApplicationContext( + private final GenericWebApplicationContext applicationContext = new GenericWebApplicationContext( new MockServletContext()); @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java index 4f6b7d1390..405122187d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java @@ -95,7 +95,7 @@ import static org.mockito.Mockito.withSettings; @ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) class ServletWebServerApplicationContextTests { - private ServletWebServerApplicationContext context = new ServletWebServerApplicationContext(); + private final ServletWebServerApplicationContext context = new ServletWebServerApplicationContext(); @Captor private ArgumentCaptor filterCaptor; @@ -495,7 +495,7 @@ class ServletWebServerApplicationContextTests { static class TestApplicationListener implements ApplicationListener { - private Deque events = new ArrayDeque<>(); + private final Deque events = new ArrayDeque<>(); @Override public void onApplicationEvent(ApplicationEvent event) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/DocumentRootTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/DocumentRootTests.java index 2212191c59..d88f067b76 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/DocumentRootTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/DocumentRootTests.java @@ -37,7 +37,7 @@ class DocumentRootTests { @TempDir File tempDir; - private DocumentRoot documentRoot = new DocumentRoot(LogFactory.getLog(getClass())); + private final DocumentRoot documentRoot = new DocumentRoot(LogFactory.getLog(getClass())); @Test void explodedWarFileDocumentRootWhenRunningFromExplodedWar() throws Exception { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/ErrorPageFilterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/ErrorPageFilterTests.java index d27d5715a1..6675a39083 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/ErrorPageFilterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/ErrorPageFilterTests.java @@ -63,11 +63,11 @@ import static org.mockito.Mockito.never; @ExtendWith(OutputCaptureExtension.class) class ErrorPageFilterTests { - private ErrorPageFilter filter = new ErrorPageFilter(); + private final ErrorPageFilter filter = new ErrorPageFilter(); - private DispatchRecordingMockHttpServletRequest request = new DispatchRecordingMockHttpServletRequest(); + private final DispatchRecordingMockHttpServletRequest request = new DispatchRecordingMockHttpServletRequest(); - private MockHttpServletResponse response = new MockHttpServletResponse(); + private final MockHttpServletResponse response = new MockHttpServletResponse(); private MockFilterChain chain = new TestFilterChain((request, response, chain) -> { }); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java index 87b3daf5fe..45e050a194 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java @@ -68,7 +68,7 @@ import static org.mockito.Mockito.mock; @ExtendWith(OutputCaptureExtension.class) class SpringBootServletInitializerTests { - private ServletContext servletContext = new MockServletContext(); + private final ServletContext servletContext = new MockServletContext(); private SpringApplication application; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewResolverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewResolverTests.java index 4208c16380..d69079b2b7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewResolverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewResolverTests.java @@ -35,7 +35,7 @@ class MustacheViewResolverTests { private final String prefix = "classpath:/" + getClass().getPackage().getName().replace(".", "/") + "/"; - private MustacheViewResolver resolver = new MustacheViewResolver(); + private final MustacheViewResolver resolver = new MustacheViewResolver(); @BeforeEach void init() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewTests.java index 3190d11423..6a4aad77a3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewTests.java @@ -40,11 +40,11 @@ class MustacheViewTests { private final String templateUrl = "classpath:/" + getClass().getPackage().getName().replace(".", "/") + "/template.html"; - private MockHttpServletRequest request = new MockHttpServletRequest(); + private final MockHttpServletRequest request = new MockHttpServletRequest(); - private MockHttpServletResponse response = new MockHttpServletResponse(); + private final MockHttpServletResponse response = new MockHttpServletResponse(); - private AnnotationConfigServletWebApplicationContext context = new AnnotationConfigServletWebApplicationContext(); + private final AnnotationConfigServletWebApplicationContext context = new AnnotationConfigServletWebApplicationContext(); @BeforeEach void init() { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-bootstrap-registry/src/main/java/smoketest/bootstrapregistry/external/svn/SubversionClient.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-bootstrap-registry/src/main/java/smoketest/bootstrapregistry/external/svn/SubversionClient.java index 663d65d87a..8b293a7d11 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-bootstrap-registry/src/main/java/smoketest/bootstrapregistry/external/svn/SubversionClient.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-bootstrap-registry/src/main/java/smoketest/bootstrapregistry/external/svn/SubversionClient.java @@ -23,7 +23,7 @@ package smoketest.bootstrapregistry.external.svn; */ public class SubversionClient { - private SubversionServerCertificate serverCertificate; + private final SubversionServerCertificate serverCertificate; public SubversionClient(SubversionServerCertificate serverCertificate) { this.serverCertificate = serverCertificate; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jetty-jsp/src/main/java/smoketest/jetty/jsp/MyRestResponse.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jetty-jsp/src/main/java/smoketest/jetty/jsp/MyRestResponse.java index ba70299074..23f33c11f6 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jetty-jsp/src/main/java/smoketest/jetty/jsp/MyRestResponse.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jetty-jsp/src/main/java/smoketest/jetty/jsp/MyRestResponse.java @@ -18,7 +18,7 @@ package smoketest.jetty.jsp; public class MyRestResponse { - private String message; + private final String message; public MyRestResponse(String message) { this.message = message; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java index 23fe1d000f..9b73a67c42 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class SampleOauth2ResourceServerApplicationTests { - private static MockWebServer server = new MockWebServer(); + private static final MockWebServer server = new MockWebServer(); private static final String VALID_TOKEN = "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJzdWJqZWN0Iiwic2NvcGUiOiJtZXNzYWdlOnJlYWQi" + "LCJleHAiOjQ2ODM4MDUxNDF9.h-j6FKRFdnTdmAueTZCdep45e6DPwqM68ZQ8doIJ1exi9YxAlbWzOwId6Bd0L5YmCmp63gGQgsBUBLzwnZQ8kLUgU" diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-reactive-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleReactiveOAuth2ResourceServerApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-reactive-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleReactiveOAuth2ResourceServerApplicationTests.java index 57eaed7e91..31d72a1b87 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-reactive-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleReactiveOAuth2ResourceServerApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-reactive-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleReactiveOAuth2ResourceServerApplicationTests.java @@ -34,7 +34,7 @@ class SampleReactiveOAuth2ResourceServerApplicationTests { @Autowired private WebTestClient webTestClient; - private static MockWebServer server = new MockWebServer(); + private static final MockWebServer server = new MockWebServer(); private static final String VALID_TOKEN = "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJzdWJqZWN0Iiwic2NvcGUiOiJtZXNzYWdlOnJlYWQi" + "LCJleHAiOjQ2ODM4MDUxNDF9.h-j6FKRFdnTdmAueTZCdep45e6DPwqM68ZQ8doIJ1exi9YxAlbWzOwId6Bd0L5YmCmp63gGQgsBUBLzwnZQ8kLUgU" diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/main/java/smoketest/test/domain/VehicleIdentificationNumber.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/main/java/smoketest/test/domain/VehicleIdentificationNumber.java index 0654df97db..9e2edccf29 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/main/java/smoketest/test/domain/VehicleIdentificationNumber.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/main/java/smoketest/test/domain/VehicleIdentificationNumber.java @@ -25,7 +25,7 @@ import org.springframework.util.Assert; */ public final class VehicleIdentificationNumber { - private String vin; + private final String vin; public VehicleIdentificationNumber(String vin) { Assert.notNull(vin, "VIN must not be null"); diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/main/java/smoketest/test/web/UserVehicleController.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/main/java/smoketest/test/web/UserVehicleController.java index 452a79605c..ebbb325141 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/main/java/smoketest/test/web/UserVehicleController.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/main/java/smoketest/test/web/UserVehicleController.java @@ -36,7 +36,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController public class UserVehicleController { - private UserVehicleService userVehicleService; + private final UserVehicleService userVehicleService; public UserVehicleController(UserVehicleService userVehicleService) { this.userVehicleService = userVehicleService; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-testng/src/main/java/smoketest/testng/SampleTestNGApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-testng/src/main/java/smoketest/testng/SampleTestNGApplication.java index 1cb4c02e84..af33ca2ee7 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-testng/src/main/java/smoketest/testng/SampleTestNGApplication.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-testng/src/main/java/smoketest/testng/SampleTestNGApplication.java @@ -28,7 +28,7 @@ import jakarta.servlet.ServletContextListener; @SpringBootApplication public class SampleTestNGApplication { - private static Log logger = LogFactory.getLog(SampleTestNGApplication.class); + private static final Log logger = LogFactory.getLog(SampleTestNGApplication.class); @Bean protected ServletContextListener listener() { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-tomcat-jsp/src/main/java/smoketest/tomcat/jsp/MyRestResponse.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-tomcat-jsp/src/main/java/smoketest/tomcat/jsp/MyRestResponse.java index cc52546cdf..04eaa54651 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-tomcat-jsp/src/main/java/smoketest/tomcat/jsp/MyRestResponse.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-tomcat-jsp/src/main/java/smoketest/tomcat/jsp/MyRestResponse.java @@ -18,7 +18,7 @@ package smoketest.tomcat.jsp; public class MyRestResponse { - private String message; + private final String message; public MyRestResponse(String message) { this.message = message; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-tomcat/src/main/java/smoketest/tomcat/SampleTomcatApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-tomcat/src/main/java/smoketest/tomcat/SampleTomcatApplication.java index 7de90b9d10..4290e11b7a 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-tomcat/src/main/java/smoketest/tomcat/SampleTomcatApplication.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-tomcat/src/main/java/smoketest/tomcat/SampleTomcatApplication.java @@ -28,7 +28,7 @@ import org.springframework.context.annotation.Bean; @SpringBootApplication public class SampleTomcatApplication { - private static Log logger = LogFactory.getLog(SampleTomcatApplication.class); + private static final Log logger = LogFactory.getLog(SampleTomcatApplication.class); @Bean protected ServletContextListener listener() { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-groovy-templates/src/main/java/smoketest/groovytemplates/InMemoryMessageRepository.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-groovy-templates/src/main/java/smoketest/groovytemplates/InMemoryMessageRepository.java index 8e8f7e924f..6b3e8f34f5 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-groovy-templates/src/main/java/smoketest/groovytemplates/InMemoryMessageRepository.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-groovy-templates/src/main/java/smoketest/groovytemplates/InMemoryMessageRepository.java @@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicLong; public class InMemoryMessageRepository implements MessageRepository { - private static AtomicLong counter = new AtomicLong(); + private static final AtomicLong counter = new AtomicLong(); private final ConcurrentMap messages = new ConcurrentHashMap<>(); diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-thymeleaf/src/main/java/smoketest/web/thymeleaf/InMemoryMessageRepository.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-thymeleaf/src/main/java/smoketest/web/thymeleaf/InMemoryMessageRepository.java index 26bf4a0698..f156e489a6 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-thymeleaf/src/main/java/smoketest/web/thymeleaf/InMemoryMessageRepository.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-thymeleaf/src/main/java/smoketest/web/thymeleaf/InMemoryMessageRepository.java @@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicLong; public class InMemoryMessageRepository implements MessageRepository { - private static AtomicLong counter = new AtomicLong(); + private static final AtomicLong counter = new AtomicLong(); private final ConcurrentMap messages = new ConcurrentHashMap<>(); diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/main/java/smoketest/webservices/endpoint/HolidayEndpoint.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/main/java/smoketest/webservices/endpoint/HolidayEndpoint.java index a00f4d0f78..b7454aa84e 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/main/java/smoketest/webservices/endpoint/HolidayEndpoint.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/main/java/smoketest/webservices/endpoint/HolidayEndpoint.java @@ -35,13 +35,13 @@ public class HolidayEndpoint { private static final String NAMESPACE_URI = "https://company.example.com/hr/schemas"; - private XPathExpression startDateExpression; + private final XPathExpression startDateExpression; - private XPathExpression endDateExpression; + private final XPathExpression endDateExpression; - private XPathExpression nameExpression; + private final XPathExpression nameExpression; - private HumanResourceService humanResourceService; + private final HumanResourceService humanResourceService; public HolidayEndpoint(HumanResourceService humanResourceService) { this.humanResourceService = humanResourceService; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/test/java/smoketest/webservices/SampleWsApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/test/java/smoketest/webservices/SampleWsApplicationTests.java index ae53d8cb32..f653974b6f 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/test/java/smoketest/webservices/SampleWsApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/test/java/smoketest/webservices/SampleWsApplicationTests.java @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(OutputCaptureExtension.class) class SampleWsApplicationTests { - private WebServiceTemplate webServiceTemplate = new WebServiceTemplate(); + private final WebServiceTemplate webServiceTemplate = new WebServiceTemplate(); @LocalServerPort private int serverPort; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/echo/EchoWebSocketHandler.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/echo/EchoWebSocketHandler.java index 9ab904ae50..a89fee31f4 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/echo/EchoWebSocketHandler.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/echo/EchoWebSocketHandler.java @@ -30,7 +30,7 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; */ public class EchoWebSocketHandler extends TextWebSocketHandler { - private static Log logger = LogFactory.getLog(EchoWebSocketHandler.class); + private static final Log logger = LogFactory.getLog(EchoWebSocketHandler.class); private final EchoService echoService; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/test/java/smoketest/websocket/jetty/SampleWebSocketsApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/test/java/smoketest/websocket/jetty/SampleWebSocketsApplicationTests.java index e66096c99a..2c3b12442d 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/test/java/smoketest/websocket/jetty/SampleWebSocketsApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/test/java/smoketest/websocket/jetty/SampleWebSocketsApplicationTests.java @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(classes = SampleJettyWebSocketsApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) class SampleWebSocketsApplicationTests { - private static Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class); + private static final Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class); @LocalServerPort private int port = 1234; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/test/java/smoketest/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/test/java/smoketest/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java index ccfb5ff35b..6f2e740a98 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/test/java/smoketest/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/test/java/smoketest/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java @@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat; webEnvironment = WebEnvironment.RANDOM_PORT) class CustomContainerWebSocketsApplicationTests { - private static Log logger = LogFactory.getLog(CustomContainerWebSocketsApplicationTests.class); + private static final Log logger = LogFactory.getLog(CustomContainerWebSocketsApplicationTests.class); @LocalServerPort private int port; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/echo/EchoWebSocketHandler.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/echo/EchoWebSocketHandler.java index f10b75de0c..d3f43b7ae4 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/echo/EchoWebSocketHandler.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/echo/EchoWebSocketHandler.java @@ -30,7 +30,7 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; */ public class EchoWebSocketHandler extends TextWebSocketHandler { - private static Log logger = LogFactory.getLog(EchoWebSocketHandler.class); + private static final Log logger = LogFactory.getLog(EchoWebSocketHandler.class); private final EchoService echoService; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/test/java/smoketest/websocket/tomcat/SampleWebSocketsApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/test/java/smoketest/websocket/tomcat/SampleWebSocketsApplicationTests.java index 642e60b983..4ef83ed85b 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/test/java/smoketest/websocket/tomcat/SampleWebSocketsApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/test/java/smoketest/websocket/tomcat/SampleWebSocketsApplicationTests.java @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(classes = SampleTomcatWebSocketApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) class SampleWebSocketsApplicationTests { - private static Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class); + private static final Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class); @LocalServerPort private int port = 1234; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/test/java/smoketest/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/test/java/smoketest/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java index 5f26119931..e0720fdba0 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/test/java/smoketest/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/test/java/smoketest/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java @@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat; webEnvironment = WebEnvironment.RANDOM_PORT) class CustomContainerWebSocketsApplicationTests { - private static Log logger = LogFactory.getLog(CustomContainerWebSocketsApplicationTests.class); + private static final Log logger = LogFactory.getLog(CustomContainerWebSocketsApplicationTests.class); @LocalServerPort private int port; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/echo/EchoWebSocketHandler.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/echo/EchoWebSocketHandler.java index 543946e7ba..1ee874097b 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/echo/EchoWebSocketHandler.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/echo/EchoWebSocketHandler.java @@ -30,7 +30,7 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; */ public class EchoWebSocketHandler extends TextWebSocketHandler { - private static Log logger = LogFactory.getLog(EchoWebSocketHandler.class); + private static final Log logger = LogFactory.getLog(EchoWebSocketHandler.class); private final EchoService echoService; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/test/java/smoketest/websocket/undertow/SampleWebSocketsApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/test/java/smoketest/websocket/undertow/SampleWebSocketsApplicationTests.java index 0ab9771969..a9e7b3ed7e 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/test/java/smoketest/websocket/undertow/SampleWebSocketsApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/test/java/smoketest/websocket/undertow/SampleWebSocketsApplicationTests.java @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(classes = SampleUndertowWebSocketsApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) class SampleWebSocketsApplicationTests { - private static Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class); + private static final Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class); @LocalServerPort private int port = 1234; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/test/java/smoketest/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/test/java/smoketest/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java index f0a361fa05..55bb2ffdfa 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/test/java/smoketest/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/test/java/smoketest/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java @@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat; webEnvironment = WebEnvironment.RANDOM_PORT) class CustomContainerWebSocketsApplicationTests { - private static Log logger = LogFactory.getLog(CustomContainerWebSocketsApplicationTests.class); + private static final Log logger = LogFactory.getLog(CustomContainerWebSocketsApplicationTests.class); @LocalServerPort private int port;