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 d1b400385ba..e4db7fee9ec 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 a94da2e4fd8..351470c7da9 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 1efbb193ac1..e7a0ee84f40 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 f2d40740448..673bfd9ef32 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 a55b49cbeaf..8f8fcdfddff 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 7e422cc5795..6f596d12f84 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 61d36f9d66f..368deea0915 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 8c53e4a0f08..39b245d4b47 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 0c07bb18007..a043fdf1b48 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 7b1d3ad0338..3fb1df57fe5 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 a7affad6a07..0862b91be73 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 f4b1fa5ddcf..3288b28d467 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 a6ee9c57a80..54d3bbcc416 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 2077bfeefac..8af724a05de 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 04e9f426256..814e71a4c72 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 6df42c00939..ea6929744cf 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 c208984e210..9705829af33 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 a6b1299045a..363ab9def36 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 27c6bdb34fc..96b11e1873f 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 06339e19c29..35490ac2a6c 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 09a94dc655d..914c1aed306 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 044b950f6de..995e3846212 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 a6bb97e03c3..f0a3453e70e 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 586f725d6f8..cc8839039b4 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 074f344ee69..fcb3592ebdd 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 9fcd44822fe..f8daf78c3a0 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 d1c324b074a..c0993c820e2 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 2a0fc984130..43fe32b8bb6 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 577e3e63a45..462ccd342b3 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 227229154c0..771cadfee9a 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 2b3b7273f78..60fbb57b413 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 b4765c68820..e75b5e1f3d0 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 fbb349313f3..6bedcb87b2c 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 17170e19dcf..2943fe17868 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 c193b36cc74..909dd8d99ce 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 5c2ef476928..854787305ce 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 b29425aeab7..60f8374bda7 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 14a5efd69fb..8ca2cbc6edf 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 ae0b04fa414..c548ad8da1e 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 6d7a65d8ce6..3d3b017171b 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 80962805a97..f75a1107448 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 714d340237d..43447c88f0f 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 9e25b3a1bcb..47a1a77cb2c 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 58417be263b..6cecbb9b033 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 61c5ec33899..f6c3f1783e0 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 c4c76c0692f..34ca52a8c74 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 7fa717ca9bc..3151e0bb903 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 ef563541a64..58c2b73c491 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 6bd99fe766c..76b2424eaf3 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 2c5e40402fb..a73cf4672bd 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 0eebeff1c50..26ad37b90ed 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 7bb9083eb7c..d54ef0e8324 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 ee8cd286d48..e3f513f50d1 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 faa312ddeb6..4bb45e6a9c5 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 7fb151a4ca6..82685205d49 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 5bfb79e00d0..51a1e24be3d 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 4e470ab631e..f47349bf7be 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 f7087dd2331..319a33ab78e 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 4bd89c1b5a5..b1194cad8ff 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 b195632c88c..436bc91e22b 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 29e84bdca3b..344e7d2a1c0 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 2ab5a426717..98facb9bdad 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 e98e7b4fe1d..57ad1559f36 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 f7d3cfe714c..7e42d04cc45 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 2b1e543d6c9..c8dfb9f8b3f 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 026c93d4e1e..ad7b7c9dca5 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 6e1f0e0aa5f..1072fd28d80 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 0cab87e316f..026a4867e9f 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 84a1de85af2..74f998a3eb5 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 f16b8324de5..41ccb73bcb3 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 703171253c3..c749cfba3b4 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 a3a9fb2ae38..39478c89aec 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 91b839c0815..0c0322a2db3 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 6b940ff5a31..14a7f4d19b0 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 318b849faab..4b535fccd6d 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 556a1d94e6c..a5f2f5de84b 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 6744843b0b9..5f25d22b5b9 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 6bf4c04bdad..e9b3fbc29f1 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 903e04463f6..ffb7e693a75 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 6d9f801594a..ad3b12830e0 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 8b5ffb37b95..c2fe68e2da5 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 662d51518e4..7eb1cd5f04a 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 59cbd17916a..b698f23106b 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 ecea4bfdc6b..f0197a630fa 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 b5e25e65c00..1af4376cac5 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 c6332774566..91d585110ed 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 9ccf1d3e105..fc34723e688 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 defa4b0a2a1..4853d675eb2 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 e2c0f1e39d9..57762ecfcdd 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 040a69e02ca..899714d82a3 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 99e90802ecc..b34434b2992 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 fe1d58d2339..a197cab94b8 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 fd3ec6a918b..bdc69f02d84 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 cf3a9c3335a..008d95230e7 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 865946206f6..189a5b861b4 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 1ca001a1410..5b39e2f7402 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 0b2641a98d6..20d5f73caab 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 f98c92a44cf..8e88690ae2a 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 52c56ab9515..03f463226fe 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 43b883149b3..984b55c6c43 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 2e5eaec18dc..807239827e5 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 bb0761fbe42..4308908a966 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 a70f1f36d9d..4e5e84b22d4 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 65ea8dab2a4..b386824df0f 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 df9a4fe0b9a..6ca346a3fb8 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 228a41779c7..46ef78dd2cd 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 717e778a434..f3e214a2267 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 cd920e17963..99c3875ad45 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 2f1304e3f65..53a328a4b95 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 07b1e75b29c..0d619f5c20b 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 d16229208c4..69e3bae254c 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 9ada5057cc5..279b2a808c0 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 d6c33fba624..6e93cd07b64 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 827494a37e6..cf8b50529df 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 92bbc754b37..ef41029b8b6 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 a2424ef339e..c9d472046c7 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 a84ebd26c77..1b6cf098a3b 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 cc9b68901c9..6b2fd8fe001 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 535d8f6f993..f2c8ebd45b6 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 6468c30e8e9..5e41374766d 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 1a0fba2da30..251e25cf7da 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 764d9dfba78..a596814e728 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 5d6a8236c39..e8257deb284 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 1e0d5cb143c..55fb5e8dbb5 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 a561fac7580..9215ef3942c 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 308e876b983..00d92f7dc8a 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 02836265b35..9c60a8da188 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 125572fc5c2..927a96dfb3a 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 c3961558be9..0e80848e90d 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 759ea2de787..b991f6e8e58 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 463d90c142b..743b0590ed3 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 5d729cde6e4..38ccbe89ed5 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 0b8cb7ea2b9..e244c3ab10d 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 05d8ed51fa3..7c66530168f 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 308827e0ae4..3d4e060d096 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 578f50b655a..af70722e09f 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 2fd99419ca4..20c33bfdf83 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 285cc599e3b..917d9743a66 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 1c25f597caa..d669b475849 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 95b2fe9d721..4614d1e57ae 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 2c27e48c6e4..1aadadec912 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 62f483e07be..1214cb6b798 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 2884ba17f39..b1fa01c228a 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 ee2583cd9a0..2dd557b0ec7 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 7b6e0628376..f278260e703 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 bc098be1b4d..babe99093ca 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 2f116f32a32..1bdba53b702 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 213cb7800b2..ac1e54c5391 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 966ac446cca..750d5879a9d 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 1c35c755592..9eee659ca09 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 6d5b3b96eda..641cf29f492 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 44350aafb42..520fc26ab9e 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 5207a3dbd24..33763389346 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 be9bc1b086f..08734078520 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 f272e64d137..6d56fa2389e 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 38d4c67c353..502c450fa73 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 3b5ba8d99a0..c9286b3e8b5 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 62f35f00102..81ed750ed64 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 1e4eceed03c..649708c587b 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 157e4c4e50d..f353eb923d6 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 489f23ec871..613143a09b6 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 a80189bda31..5f86161ebc8 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 f71fe1437c2..79b57cd648c 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 e2cfe7bd2cd..2677ae0edb9 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 e7b187b6793..e1b5f914232 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 742f6f8f99c..cf1694bcde0 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 00ea7c33628..26889c08c56 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 fdb806123a0..db0586c3431 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 e7b9eae2e86..392f3aacc6f 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 4a1d3e21ea7..8d6a0698c0a 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 7a8a89031f0..07703a1860e 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 497eadb4f56..06bd7d62ab0 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 be30cc7ac63..7c47a1b59c9 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 22ca86f40ec..359ce2f73ad 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 36e7ac836d9..0e232d8ec53 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 62f0d52ce76..85161bbfbc7 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 ae14a41c331..3ada700326d 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 874e2ed0d87..50aef225507 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 9420c7696d7..d634a32fa95 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 371bb8c1f33..29abdb30695 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 eaeeeff5bf7..96901fedce4 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 accda1edaa6..572b2fd12d7 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 5cbb6640b67..285f76f0530 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 4c6a3981fdb..0d10f2a96d9 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 05dff44cac1..123a69b972d 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 25880cf6be8..30781cf9ac6 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 f1527bfcbec..3bcbe70922e 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 8b375a00a78..57f4e988c8e 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 1e11c86e4bb..6492cf335f3 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 96a17e4aff0..6484babdc3a 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 7482cd4a835..9a4fdfaf1c8 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 dd452ac329d..e768ce18285 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 73082f3f6ae..1eda05408ea 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 2f538516b42..8a5bedb5cbe 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 bc236152017..850d70b285d 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 ff1ffbcd01d..26e10270cdd 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 0c839e06d69..ceac757198a 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 624136c491b..ddef7ae332a 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 14cb46447c8..5b907b7fbd4 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 81821653afb..85a2134ee29 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 206c76d0c20..a4db4c40d08 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 8332a7b4f86..2e70f9f3566 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 e47abe01d3a..0a86faca1e8 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 f93c734e6a4..f2ebd4c55b6 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 3287efaf3ef..fc25f61dc4b 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 a9f61afaa90..bb78061bc28 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 f9f1e639dfe..99e2cad3df8 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 b0e8ad3b7de..9029dc49593 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 290315ca3d0..631727fae57 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 1ac12648d44..a7e0762e280 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 f4077af3c75..44233419918 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 3651bbe0a5d..852bbe84831 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 9b4d01fe7b1..6b6ca99da3e 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 f8f6c0884cb..11115bf7f4b 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 7a2c253e0fb..42a0654352a 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 93116d2af32..847dd4dfec7 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 1c9c2f4da4c..285bd661b7e 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 7bd7121b345..118ce6105a4 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 9ead5a94033..007415c30d0 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 fc41f4d91c8..7f0118c4b18 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 2873bc44385..bafa5ad6159 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 df9c908ef9e..2f9cf36802f 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 d557c416b17..ae1ce3b79bc 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 f10e46b2cd4..516132b74a5 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 cec4eec1970..b7298c3c02f 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 a2a4b1f37b2..a7b9a3596ac 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 6378f433226..d2377ac6996 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 aaee7ba44b6..a6237cd01d5 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 7eb604bef8f..93dab242d15 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 3bf41d636de..191f863b487 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 5fe5d23261d..ff03e03bdd1 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 0bf0eb14bdb..4dfb0afa811 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 8bcdd0e5122..6cdc9c9dd7e 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 ef21aea8da3..47b15d2d03e 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 4192448c46d..425da5596ae 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 af862453b4c..45a16e4e4ee 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 a51ce2f1a3a..19d892de18b 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 f90a20c2c19..711023d920f 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 9df913875c5..f0f384976b1 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 982224626fd..1343cdb11e2 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 0f9178d3572..1198b4075f7 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 16d10379a49..814d6b2ae21 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 b680ce43107..776474c46ef 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 dcba31b1dbc..30104a86f35 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 c887824089e..e0f472355af 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 86f4d028dcf..aea0e6e5c7b 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 9b6eb15ad08..857fe8a15b3 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 183a491934f..c06ded413d6 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 b9f8786f436..c7cd82ac53a 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 25c6f944b78..a43675e11f0 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 47f29318e26..8b2e706317d 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 53a4ba7bbca..358a6adf129 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 f869a62d77a..8f93c71d5db 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 bfecd40007e..4c76b6dd627 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 eb0adb72335..229f240f554 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 e0a18eae52b..25e6ded7c07 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 4f6b7d13906..405122187d8 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 2212191c59d..d88f067b769 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 d27d5715a16..6675a390833 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 87b3daf5fe7..45e050a1949 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 4208c163806..d69079b2b74 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 3190d114238..6a4aad77a33 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 663d65d87ab..8b293a7d119 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 ba70299074c..23f33c11f65 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 23fe1d000fd..9b73a67c420 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 57eaed7e912..31d72a1b87c 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 0654df97dbf..9e2edccf29f 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 452a79605c0..ebbb3251413 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 1cb4c02e843..af33ca2ee7b 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 cc52546cdf4..04eaa546511 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 7de90b9d10f..4290e11b7a2 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 8e8f7e924f7..6b3e8f34f58 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 26bf4a0698a..f156e489a6b 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 a00f4d0f78d..b7454aa84e8 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 ae53d8cb320..f653974b6f7 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 9ab904ae505..a89fee31f4b 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 e66096c99a7..2c3b12442d1 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 ccfb5ff35b8..6f2e740a98a 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 f10b75de0c8..d3f43b7ae4a 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 642e60b9839..4ef83ed85b1 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 5f261199315..e0720fdba0a 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 543946e7ba2..1ee874097b6 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 0ab9771969b..a9e7b3ed7e5 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 f0a361fa058..55bb2ffdfae 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;