diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java index 07b7f175c9..dbea8b4b3b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java @@ -32,7 +32,7 @@ public class InMemoryAuditEventRepository implements AuditEventRepository { private int capacity = 100; - private Map> events = new HashMap>(); + private final Map> events = new HashMap>(); /** * @param capacity the capacity to set diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/listener/AuditApplicationEvent.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/listener/AuditApplicationEvent.java index b02a5c4eed..b78fd24966 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/listener/AuditApplicationEvent.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/listener/AuditApplicationEvent.java @@ -30,7 +30,7 @@ import org.springframework.util.Assert; */ public class AuditApplicationEvent extends ApplicationEvent { - private AuditEvent auditEvent; + private final AuditEvent auditEvent; /** * Create a new {@link AuditApplicationEvent} that wraps a newly created diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/AuditAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/AuditAutoConfiguration.java index 6a87e9bf36..4bc82fac4f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/AuditAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/AuditAutoConfiguration.java @@ -38,7 +38,7 @@ import org.springframework.context.annotation.Configuration; public class AuditAutoConfiguration { @Autowired(required = false) - private AuditEventRepository auditEventRepository = new InMemoryAuditEventRepository(); + private final AuditEventRepository auditEventRepository = new InMemoryAuditEventRepository(); @Bean public AuditListener auditListener() throws Exception { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java index 76cf60a7e0..8e1f4035de 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java @@ -340,9 +340,9 @@ public class CrshAutoConfiguration { private static class BeanFactoryFilteringPluginDiscovery extends ServiceLoaderDiscovery { - private ListableBeanFactory beanFactory; + private final ListableBeanFactory beanFactory; - private String[] disabledPlugins; + private final String[] disabledPlugins; public BeanFactoryFilteringPluginDiscovery(ClassLoader classLoader, ListableBeanFactory beanFactory, String[] disabledPlugins) @@ -409,7 +409,7 @@ public class CrshAutoConfiguration { */ private static class SimpleFileSystemDriver extends AbstractFSDriver { - private ResourceHandle root; + private final ResourceHandle root; public SimpleFileSystemDriver(ResourceHandle handle) { this.root = handle; @@ -463,7 +463,7 @@ public class CrshAutoConfiguration { */ private abstract static class ResourceHandle { - private String name; + private final String name; public ResourceHandle(String name) { this.name = name; @@ -480,7 +480,7 @@ public class CrshAutoConfiguration { */ private static class DirectoryHandle extends ResourceHandle { - private ResourcePatternResolver resourceLoader; + private final ResourcePatternResolver resourceLoader; public DirectoryHandle(String name, ResourcePatternResolver resourceLoader) { super(name); @@ -505,7 +505,7 @@ public class CrshAutoConfiguration { */ private static class FileHandle extends ResourceHandle { - private Resource resource; + private final Resource resource; public FileHandle(String name, Resource resource) { super(name); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java index 95f95acf0f..a9c924a0f0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java @@ -78,13 +78,13 @@ public class EndpointAutoConfiguration { private InfoPropertiesConfiguration properties; @Autowired(required = false) - private MetricReader metricRepository = new InMemoryMetricRepository(); + private final MetricReader metricRepository = new InMemoryMetricRepository(); @Autowired(required = false) private PublicMetrics metrics; @Autowired(required = false) - private TraceRepository traceRepository = new InMemoryTraceRepository(); + private final TraceRepository traceRepository = new InMemoryTraceRepository(); @Bean @ConditionalOnMissingBean @@ -170,7 +170,7 @@ public class EndpointAutoConfiguration { protected static class InfoPropertiesConfiguration { @Autowired - private ConfigurableEnvironment environment = new StandardEnvironment(); + private final ConfigurableEnvironment environment = new StandardEnvironment(); @Value("${spring.git.properties:classpath:git.properties}") private Resource gitProperties; @@ -198,7 +198,7 @@ public class EndpointAutoConfiguration { public static class GitInfo { private String branch; - private Commit commit = new Commit(); + private final Commit commit = new Commit(); public String getBranch() { return this.branch; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ErrorMvcAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ErrorMvcAutoConfiguration.java index 2b6b0c8712..f4de7e4c82 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ErrorMvcAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ErrorMvcAutoConfiguration.java @@ -89,7 +89,7 @@ public class ErrorMvcAutoConfiguration implements EmbeddedServletContainerCustom @Conditional(ErrorTemplateMissingCondition.class) protected static class WhitelabelErrorViewConfiguration { - private SpelView defaultErrorView = new SpelView( + private final SpelView defaultErrorView = new SpelView( "

Whitelabel Error Page

" + "

This application has no explicit mapping for /error, so you are seeing this as a fallback.

" + "
${timestamp}
" diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java index d6ca68499e..5c78d6d7ee 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java @@ -123,7 +123,7 @@ public class MetricRepositoryAutoConfiguration { @Autowired(required = false) @Qualifier("metricsExecutor") - private Executor executor = Executors.newSingleThreadExecutor(); + private final Executor executor = Executors.newSingleThreadExecutor(); @Bean @ConditionalOnMissingBean(name = "metricsChannel") diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java index 83fed278c8..3d5542d032 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java @@ -39,9 +39,9 @@ import org.springframework.core.env.Environment; public class BeansEndpoint extends AbstractEndpoint> implements ApplicationContextAware { - private LiveBeansView liveBeansView = new LiveBeansView(); + private final LiveBeansView liveBeansView = new LiveBeansView(); - private JsonParser parser = JsonParserFactory.getJsonParser(); + private final JsonParser parser = JsonParserFactory.getJsonParser(); public BeansEndpoint() { super("beans"); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java index 6821bb2414..1b19355ab6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java @@ -28,7 +28,7 @@ import org.springframework.util.Assert; @ConfigurationProperties(name = "endpoints.health", ignoreUnknownFields = false) public class HealthEndpoint extends AbstractEndpoint { - private HealthIndicator indicator; + private final HealthIndicator indicator; /** * Create a new {@link HealthIndicator} instance. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java index a9ce11b6c6..5a87eaa749 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java @@ -31,7 +31,7 @@ import org.springframework.util.Assert; @ConfigurationProperties(name = "endpoints.info", ignoreUnknownFields = false) public class InfoEndpoint extends AbstractEndpoint> { - private Map info; + private final Map info; /** * Create a new {@link InfoEndpoint} instance. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpoint.java index 286f4e61ba..478eb1d131 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpoint.java @@ -31,7 +31,7 @@ import org.springframework.util.Assert; @ConfigurationProperties(name = "endpoints.metrics", ignoreUnknownFields = false) public class MetricsEndpoint extends AbstractEndpoint> { - private PublicMetrics metrics; + private final PublicMetrics metrics; /** * Create a new {@link MetricsEndpoint} instance. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TraceEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TraceEndpoint.java index cf69bb6b56..2227f81c98 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TraceEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TraceEndpoint.java @@ -31,7 +31,7 @@ import org.springframework.util.Assert; @ConfigurationProperties(name = "endpoints.trace", ignoreUnknownFields = false) public class TraceEndpoint extends AbstractEndpoint> { - private TraceRepository repository; + private final TraceRepository repository; /** * Create a new {@link TraceEndpoint} instance. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/VanillaPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/VanillaPublicMetrics.java index 37c4e1daa8..de647636c0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/VanillaPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/VanillaPublicMetrics.java @@ -31,7 +31,7 @@ import org.springframework.util.Assert; */ public class VanillaPublicMetrics implements PublicMetrics { - private MetricReader reader; + private final MetricReader reader; public VanillaPublicMetrics(MetricReader reader) { Assert.notNull(reader, "MetricReader must not be null"); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBean.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBean.java index 086b5a883c..a61bb35e18 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBean.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBean.java @@ -35,9 +35,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; @ManagedResource public class EndpointMBean { - private Endpoint endpoint; + private final Endpoint endpoint; - private ObjectMapper mapper = new ObjectMapper(); + private final ObjectMapper mapper = new ObjectMapper(); public EndpointMBean(String beanName, Endpoint endpoint) { Assert.notNull(beanName, "BeanName must not be null"); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java index b197a8e7a0..172413b5b0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java @@ -66,7 +66,7 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc private final MetadataNamingStrategy defaultNamingStrategy = new MetadataNamingStrategy( this.attributeSource); - private Set> registeredEndpoints = new HashSet>(); + private final Set> registeredEndpoints = new HashSet>(); private volatile boolean autoStartup = true; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java index 908b16c9eb..99420f240d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java @@ -50,7 +50,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl public class EndpointHandlerMapping extends RequestMappingHandlerMapping implements ApplicationContextAware { - private Set endpoints; + private final Set endpoints; private String prefix = ""; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java index 8f4d03edeb..e41182da9f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java @@ -54,7 +54,7 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, private boolean enabled = true; - private ServletWrappingController controller = new ServletWrappingController(); + private final ServletWrappingController controller = new ServletWrappingController(); public JolokiaMvcEndpoint() { this.path = "/jolokia"; @@ -123,7 +123,7 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, private static class PathStripper extends HttpServletRequestWrapper { - private String path; + private final String path; public PathStripper(HttpServletRequest request, String path) { super(request); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java index 5b7e329614..7880a44ba6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java @@ -39,7 +39,7 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean { private ApplicationContext applicationContext; - private Set endpoints = new HashSet(); + private final Set endpoints = new HashSet(); private Set> customTypes; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java index d7012ea429..c1ce8697a6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java @@ -36,9 +36,9 @@ import org.springframework.boot.actuate.metrics.writer.Delta; public class InMemoryMetricRepository implements MetricRepository, MultiMetricRepository, PrefixMetricReader { - private SimpleInMemoryRepository> metrics = new SimpleInMemoryRepository>(); + private final SimpleInMemoryRepository> metrics = new SimpleInMemoryRepository>(); - private Collection groups = new HashSet(); + private final Collection groups = new HashSet(); @Override public void increment(Delta delta) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java index f8db3f35da..e819eaa172 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java @@ -47,11 +47,11 @@ public class RedisMetricRepository implements MetricRepository { private String keys = this.prefix + "keys"; - private BoundZSetOperations zSetOperations; + private final BoundZSetOperations zSetOperations; - private RedisOperations redisOperations; + private final RedisOperations redisOperations; - private ValueOperations longOperations; + private final ValueOperations longOperations; public RedisMetricRepository(RedisConnectionFactory redisConnectionFactory) { Assert.notNull(redisConnectionFactory, "RedisConnectionFactory must not be null"); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java index fea6f68e3e..3067d0c6bc 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java @@ -46,9 +46,9 @@ public class RedisMultiMetricRepository implements MultiMetricRepository { private String keys = this.prefix + "keys"; - private BoundZSetOperations zSetOperations; + private final BoundZSetOperations zSetOperations; - private RedisOperations redisOperations; + private final RedisOperations redisOperations; public RedisMultiMetricRepository(RedisConnectionFactory redisConnectionFactory) { Assert.notNull(redisConnectionFactory, "RedisConnectionFactory must not be null"); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepository.java index 3c09421f0f..b8f309c4ed 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepository.java @@ -32,7 +32,7 @@ import org.springframework.boot.actuate.metrics.writer.MetricWriter; */ public class InMemoryRichGaugeRepository implements RichGaugeRepository { - private SimpleInMemoryRepository repository = new SimpleInMemoryRepository(); + private final SimpleInMemoryRepository repository = new SimpleInMemoryRepository(); @Override public void increment(Delta delta) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java index a434a0b2e8..87ba26382a 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java @@ -30,9 +30,9 @@ import java.util.concurrent.ConcurrentSkipListMap; */ public class SimpleInMemoryRepository { - private ConcurrentNavigableMap values = new ConcurrentSkipListMap(); + private final ConcurrentNavigableMap values = new ConcurrentSkipListMap(); - private ConcurrentMap locks = new ConcurrentHashMap(); + private final ConcurrentMap locks = new ConcurrentHashMap(); public static interface Callback { T modify(T current); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/CompositeMetricWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/CompositeMetricWriter.java index 881695a8fa..0e2186a9cf 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/CompositeMetricWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/CompositeMetricWriter.java @@ -29,7 +29,7 @@ import org.springframework.boot.actuate.metrics.Metric; */ public class CompositeMetricWriter implements MetricWriter { - private List writers = new ArrayList(); + private final List writers = new ArrayList(); public CompositeMetricWriter(MetricWriter... writers) { for (MetricWriter writer : writers) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriter.java index 2beb8c585e..210809a44b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriter.java @@ -31,7 +31,7 @@ public class MessageChannelMetricWriter implements MetricWriter { private static final String METRIC_NAME = "metricName"; - private String DELETE = "delete"; + private final String DELETE = "delete"; private final MessageChannel channel; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ManagementServerProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ManagementServerProperties.java index 483b7bd1f7..037617ca4e 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ManagementServerProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ManagementServerProperties.java @@ -42,7 +42,7 @@ public class ManagementServerProperties implements SecurityPrequisite { @NotNull private String contextPath = ""; - private Security security = maybeCreateSecurity(); + private final Security security = maybeCreateSecurity(); /** * Returns the management port or {@code null} if the diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ShellProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ShellProperties.java index 132bd2530d..c353db9a5e 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ShellProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ShellProperties.java @@ -57,9 +57,9 @@ public class ShellProperties { private String[] disabledPlugins = new String[0]; - private Ssh ssh = new Ssh(); + private final Ssh ssh = new Ssh(); - private Telnet telnet = new Telnet(); + private final Telnet telnet = new Telnet(); public void setAuth(String auth) { Assert.hasLength(auth, "Auth must not be empty"); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/InMemoryTraceRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/InMemoryTraceRepository.java index 1a9ce9ec7e..90de3d73ac 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/InMemoryTraceRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/InMemoryTraceRepository.java @@ -31,7 +31,7 @@ public class InMemoryTraceRepository implements TraceRepository { private int capacity = 100; - private List traces = new ArrayList(); + private final List traces = new ArrayList(); /** * @param capacity the capacity to set diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/Trace.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/Trace.java index f797f32271..fbf4faaf42 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/Trace.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/Trace.java @@ -29,9 +29,9 @@ import org.springframework.util.Assert; */ public final class Trace { - private Date timestamp; + private final Date timestamp; - private Map info; + private final Map info; public Trace(Date timestamp, Map info) { super(); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java index 8ddb0b5afa..2fe115367e 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java @@ -55,7 +55,7 @@ public class WebRequestTraceFilter implements Filter, Ordered { private int order = Integer.MAX_VALUE; - private ObjectMapper objectMapper = new ObjectMapper(); + private final ObjectMapper objectMapper = new ObjectMapper(); private BasicErrorController errorController; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/BasicErrorController.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/BasicErrorController.java index 5067aaaacc..8fb01de0d3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/BasicErrorController.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/BasicErrorController.java @@ -51,7 +51,7 @@ public class BasicErrorController implements ErrorController { private static final String ERROR_KEY = "error"; - private Log logger = LogFactory.getLog(BasicErrorController.class); + private final Log logger = LogFactory.getLog(BasicErrorController.class); @Value("${error.path:/error}") private String errorPath; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java index a6a9418391..8015a555e9 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java @@ -29,7 +29,7 @@ import static org.junit.Assert.assertEquals; */ public class InMemoryAuditEventRepositoryTests { - private InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository(); + private final InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository(); @Test public void testAddToCapacity() throws Exception { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java index 7c0cd8c59e..2b02b9aabc 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java @@ -56,7 +56,7 @@ import static org.junit.Assert.assertThat; */ public class EndpointWebMvcAutoConfigurationTests { - private AnnotationConfigEmbeddedWebApplicationContext applicationContext = new AnnotationConfigEmbeddedWebApplicationContext(); + private final AnnotationConfigEmbeddedWebApplicationContext applicationContext = new AnnotationConfigEmbeddedWebApplicationContext(); @After public void close() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java index 9a01ba3b83..91c30a4133 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java @@ -44,7 +44,7 @@ import static org.junit.Assert.assertThat; */ public class EndpointHandlerMappingTests { - private StaticApplicationContext context = new StaticApplicationContext(); + private final StaticApplicationContext context = new StaticApplicationContext(); private Method method; @Before diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SimpleHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SimpleHealthIndicatorTests.java index 2afa405d09..8ca89bcadf 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SimpleHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SimpleHealthIndicatorTests.java @@ -40,7 +40,7 @@ import static org.mockito.Mockito.when; */ public class SimpleHealthIndicatorTests { - private SimpleHealthIndicator indicator = new SimpleHealthIndicator(); + private final SimpleHealthIndicator indicator = new SimpleHealthIndicator(); private DriverManagerDataSource dataSource; @Before diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporterTests.java index 67a29e84b0..accd5d60ca 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporterTests.java @@ -29,9 +29,9 @@ import static org.junit.Assert.assertEquals; */ public class MetricCopyExporterTests { - private InMemoryMetricRepository writer = new InMemoryMetricRepository(); - private InMemoryMetricRepository reader = new InMemoryMetricRepository(); - private MetricCopyExporter exporter = new MetricCopyExporter(this.reader, this.writer); + private final InMemoryMetricRepository writer = new InMemoryMetricRepository(); + private final InMemoryMetricRepository reader = new InMemoryMetricRepository(); + private final MetricCopyExporter exporter = new MetricCopyExporter(this.reader, this.writer); @Test public void export() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java index 54b694404c..5f41f3af79 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java @@ -32,11 +32,11 @@ import static org.junit.Assert.assertEquals; */ public class PrefixMetricGroupExporterTests { - private InMemoryMetricRepository reader = new InMemoryMetricRepository(); + private final InMemoryMetricRepository reader = new InMemoryMetricRepository(); - private InMemoryMetricRepository writer = new InMemoryMetricRepository(); + private final InMemoryMetricRepository writer = new InMemoryMetricRepository(); - private PrefixMetricGroupExporter exporter = new PrefixMetricGroupExporter( + private final PrefixMetricGroupExporter exporter = new PrefixMetricGroupExporter( this.reader, this.writer); @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/RichGaugeExporterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/RichGaugeExporterTests.java index ae30c5275b..4735af10e7 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/RichGaugeExporterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/RichGaugeExporterTests.java @@ -29,9 +29,9 @@ import static org.junit.Assert.assertEquals; */ public class RichGaugeExporterTests { - private InMemoryRichGaugeRepository reader = new InMemoryRichGaugeRepository(); - private InMemoryMetricRepository writer = new InMemoryMetricRepository(); - private RichGaugeExporter exporter = new RichGaugeExporter(this.reader, this.writer); + private final InMemoryRichGaugeRepository reader = new InMemoryRichGaugeRepository(); + private final InMemoryMetricRepository writer = new InMemoryMetricRepository(); + private final RichGaugeExporter exporter = new RichGaugeExporter(this.reader, this.writer); @Test public void prefixedMetricsCopied() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepositoryTests.java index 4cb3e3bd50..dbc20a4b1a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepositoryTests.java @@ -29,7 +29,7 @@ import static org.junit.Assert.assertEquals; */ public class InMemoryMetricRepositoryTests { - private InMemoryMetricRepository repository = new InMemoryMetricRepository(); + private final InMemoryMetricRepository repository = new InMemoryMetricRepository(); @Test public void increment() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryPrefixMetricRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryPrefixMetricRepositoryTests.java index 58f0dcc3e9..cbf3b99c04 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryPrefixMetricRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryPrefixMetricRepositoryTests.java @@ -31,7 +31,7 @@ import static org.junit.Assert.assertTrue; */ public class InMemoryPrefixMetricRepositoryTests { - private InMemoryMetricRepository repository = new InMemoryMetricRepository(); + private final InMemoryMetricRepository repository = new InMemoryMetricRepository(); @Test public void registeredPrefixCounted() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisServer.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisServer.java index 2afaf2ab6c..003b5f91c3 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisServer.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisServer.java @@ -38,7 +38,7 @@ public class RedisServer implements TestRule { protected LettuceConnectionFactory resource; - private String resourceDescription = "Redis ConnectionFactory"; + private final String resourceDescription = "Redis ConnectionFactory"; private static final Log logger = LogFactory.getLog(RedisServer.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepositoryTests.java index ac8383977d..3b4a5f3b58 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepositoryTests.java @@ -26,7 +26,7 @@ import static org.junit.Assert.assertEquals; */ public class InMemoryRichGaugeRepositoryTests { - private InMemoryRichGaugeRepository repository = new InMemoryRichGaugeRepository(); + private final InMemoryRichGaugeRepository repository = new InMemoryRichGaugeRepository(); @Test public void writeAndRead() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/InMemoryRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/InMemoryRepositoryTests.java index b9e825a184..0349376bd3 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/InMemoryRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/InMemoryRepositoryTests.java @@ -37,7 +37,7 @@ import static org.junit.Assert.assertTrue; */ public class InMemoryRepositoryTests { - private SimpleInMemoryRepository repository = new SimpleInMemoryRepository(); + private final SimpleInMemoryRepository repository = new SimpleInMemoryRepository(); @Test public void setAndGet() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriterTests.java index 150bed13ef..226f0fa676 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriterTests.java @@ -29,8 +29,8 @@ import static org.junit.Assert.assertEquals; */ public class CodahaleMetricWriterTests { - private MetricRegistry registry = new MetricRegistry(); - private CodahaleMetricWriter writer = new CodahaleMetricWriter(this.registry); + private final MetricRegistry registry = new MetricRegistry(); + private final CodahaleMetricWriter writer = new CodahaleMetricWriter(this.registry); @Test public void incrementCounter() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DefaultCounterServiceTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DefaultCounterServiceTests.java index 1ad200a94d..3000d387a0 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DefaultCounterServiceTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DefaultCounterServiceTests.java @@ -28,9 +28,9 @@ import static org.mockito.Mockito.verify; */ public class DefaultCounterServiceTests { - private MetricWriter repository = mock(MetricWriter.class); + private final MetricWriter repository = mock(MetricWriter.class); - private DefaultCounterService service = new DefaultCounterService(this.repository); + private final DefaultCounterService service = new DefaultCounterService(this.repository); @Test public void incrementPrependsCounter() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DefaultGaugeServiceTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DefaultGaugeServiceTests.java index 61dd5e99a9..39e75c8755 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DefaultGaugeServiceTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DefaultGaugeServiceTests.java @@ -29,9 +29,9 @@ import static org.mockito.Mockito.verify; */ public class DefaultGaugeServiceTests { - private MetricWriter repository = mock(MetricWriter.class); + private final MetricWriter repository = mock(MetricWriter.class); - private DefaultGaugeService service = new DefaultGaugeService(this.repository); + private final DefaultGaugeService service = new DefaultGaugeService(this.repository); @Test public void setPrependsGauge() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java index 9703878917..f169fa029f 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java @@ -30,9 +30,9 @@ import static org.mockito.Mockito.verify; */ public class MessageChannelMetricWriterTests { - private MessageChannel channel = mock(MessageChannel.class); + private final MessageChannel channel = mock(MessageChannel.class); - private MessageChannelMetricWriter observer = new MessageChannelMetricWriter( + private final MessageChannelMetricWriter observer = new MessageChannelMetricWriter( this.channel); @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java index 4ad20c2ca1..3c0f2f3825 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java @@ -37,9 +37,9 @@ import static org.mockito.Mockito.verify; */ public class AuthenticationAuditListenerTests { - private AuthenticationAuditListener listener = new AuthenticationAuditListener(); + private final AuthenticationAuditListener listener = new AuthenticationAuditListener(); - private ApplicationEventPublisher publisher = Mockito + private final ApplicationEventPublisher publisher = Mockito .mock(ApplicationEventPublisher.class); @Before diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java index 2f6bb01640..8112af6e82 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java @@ -37,9 +37,9 @@ import static org.mockito.Mockito.verify; */ public class AuthorizationAuditListenerTests { - private AuthorizationAuditListener listener = new AuthorizationAuditListener(); + private final AuthorizationAuditListener listener = new AuthorizationAuditListener(); - private ApplicationEventPublisher publisher = Mockito + private final ApplicationEventPublisher publisher = Mockito .mock(ApplicationEventPublisher.class); @Before diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/InMemoryTraceRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/InMemoryTraceRepositoryTests.java index d1ccbf9958..257a64a4d8 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/InMemoryTraceRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/InMemoryTraceRepositoryTests.java @@ -30,7 +30,7 @@ import static org.junit.Assert.assertEquals; */ public class InMemoryTraceRepositoryTests { - private InMemoryTraceRepository repository = new InMemoryTraceRepository(); + private final InMemoryTraceRepository repository = new InMemoryTraceRepository(); @Test public void capacityLimited() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java index 69bd26b01c..0eb3815444 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java @@ -32,7 +32,7 @@ import static org.junit.Assert.assertEquals; */ public class WebRequestTraceFilterTests { - private WebRequestTraceFilter filter = new WebRequestTraceFilter( + private final WebRequestTraceFilter filter = new WebRequestTraceFilter( new InMemoryTraceRepository()); @Test diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationReport.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationReport.java index 2f83d71820..0d5fcd2f38 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationReport.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationReport.java @@ -119,7 +119,7 @@ public class AutoConfigurationReport { */ public static class ConditionAndOutcomes implements Iterable { - private Set outcomes = new LinkedHashSet(); + private final Set outcomes = new LinkedHashSet(); public void add(Condition condition, ConditionOutcome outcome) { this.outcomes.add(new ConditionAndOutcome(condition, outcome)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java index 93f6653124..eefbbdd2f4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java @@ -47,7 +47,7 @@ import org.springframework.util.Assert; */ class AutoConfigurationSorter { - private CachingMetadataReaderFactory metadataReaderFactory; + private final CachingMetadataReaderFactory metadataReaderFactory; public AutoConfigurationSorter(ResourceLoader resourceLoader) { Assert.notNull(resourceLoader, "ResourceLoader must not be null"); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BasicBatchConfigurer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BasicBatchConfigurer.java index 0fe2270477..3036489dfd 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BasicBatchConfigurer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BasicBatchConfigurer.java @@ -42,9 +42,9 @@ public class BasicBatchConfigurer implements BatchConfigurer { private static Log logger = LogFactory.getLog(BasicBatchConfigurer.class); - private DataSource dataSource; + private final DataSource dataSource; - private EntityManagerFactory entityManagerFactory; + private final EntityManagerFactory entityManagerFactory; private PlatformTransactionManager transactionManager; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionEvent.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionEvent.java index fde47f745d..9e704fb810 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionEvent.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionEvent.java @@ -26,7 +26,7 @@ import org.springframework.context.ApplicationEvent; */ public class JobExecutionEvent extends ApplicationEvent { - private JobExecution execution; + private final JobExecution execution; /** * @param execution the job execution diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java index 351acb5930..1695c4056d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java @@ -31,7 +31,7 @@ import org.springframework.context.ApplicationListener; public class JobExecutionExitCodeGenerator implements ApplicationListener, ExitCodeGenerator { - private List executions = new ArrayList(); + private final List executions = new ArrayList(); @Override public void onApplicationEvent(JobExecutionEvent event) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java index 1ad46f7dc3..81ad93d6a4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java @@ -53,7 +53,7 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, private static Log logger = LogFactory.getLog(JobLauncherCommandLineRunner.class); @Autowired(required = false) - private JobParametersConverter converter = new DefaultJobParametersConverter(); + private final JobParametersConverter converter = new DefaultJobParametersConverter(); @Autowired private JobLauncher jobLauncher; @@ -64,7 +64,7 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, private String jobName; @Autowired(required = false) - private Collection jobs = Collections.emptySet(); + private final Collection jobs = Collections.emptySet(); private ApplicationEventPublisher publisher; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java index 419984c2a9..11cb54f53c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java @@ -180,13 +180,13 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit private static class BeanSearchSpec { - private List names = new ArrayList(); + private final List names = new ArrayList(); - private List types = new ArrayList(); + private final List types = new ArrayList(); - private List annotations = new ArrayList(); + private final List annotations = new ArrayList(); - private SearchStrategy strategy; + private final SearchStrategy strategy; public BeanSearchSpec(ConditionContext context, AnnotatedTypeMetadata metadata, Class annotationType) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java index 149e1049a9..b220bd0e8a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java @@ -35,7 +35,7 @@ import org.springframework.util.MultiValueMap; */ class OnResourceCondition extends SpringBootCondition { - private ResourceLoader defaultResourceLoader = new DefaultResourceLoader(); + private final ResourceLoader defaultResourceLoader = new DefaultResourceLoader(); @Override public ConditionOutcome getMatchOutcome(ConditionContext context, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java index 91495b87b4..eff59011ac 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java @@ -252,7 +252,7 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { */ static class BasicDatabaseCondition extends NonEmbeddedDatabaseCondition { - private Condition tomcatCondition = new TomcatDatabaseCondition(); + private final Condition tomcatCondition = new TomcatDatabaseCondition(); @Override protected String getDataSourceClassName() { @@ -286,9 +286,9 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { */ static class EmbeddedDatabaseCondition extends SpringBootCondition { - private SpringBootCondition tomcatCondition = new TomcatDatabaseCondition(); + private final SpringBootCondition tomcatCondition = new TomcatDatabaseCondition(); - private SpringBootCondition dbcpCondition = new BasicDatabaseCondition(); + private final SpringBootCondition dbcpCondition = new BasicDatabaseCondition(); @Override public ConditionOutcome getMatchOutcome(ConditionContext context, @@ -311,11 +311,11 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { */ static class DatabaseCondition extends SpringBootCondition { - private SpringBootCondition tomcatCondition = new TomcatDatabaseCondition(); + private final SpringBootCondition tomcatCondition = new TomcatDatabaseCondition(); - private SpringBootCondition dbcpCondition = new BasicDatabaseCondition(); + private final SpringBootCondition dbcpCondition = new BasicDatabaseCondition(); - private SpringBootCondition embeddedCondition = new EmbeddedDatabaseCondition(); + private final SpringBootCondition embeddedCondition = new EmbeddedDatabaseCondition(); @Override public ConditionOutcome getMatchOutcome(ConditionContext context, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java index 55bf167fa2..41f23da1f0 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java @@ -40,13 +40,13 @@ public class SecurityProperties implements SecurityPrequisite { private Basic basic = new Basic(); - private Headers headers = new Headers(); + private final Headers headers = new Headers(); private SessionCreationPolicy sessions = SessionCreationPolicy.STATELESS; private List ignored = new ArrayList(); - private User user = new User(); + private final User user = new User(); public Headers getHeaders() { return this.headers; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java index 4d0c782849..df6e8c0a17 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java @@ -63,7 +63,7 @@ public class ThymeleafAutoConfiguration { public static class DefaultTemplateResolverConfiguration implements EnvironmentAware { @Autowired - private ResourceLoader resourceLoader = new DefaultResourceLoader(); + private final ResourceLoader resourceLoader = new DefaultResourceLoader(); private RelaxedPropertyResolver environment; @@ -108,10 +108,10 @@ public class ThymeleafAutoConfiguration { protected static class ThymeleafDefaultConfiguration { @Autowired - private Collection templateResolvers = Collections.emptySet(); + private final Collection templateResolvers = Collections.emptySet(); @Autowired(required = false) - private Collection dialects = Collections.emptySet(); + private final Collection dialects = Collections.emptySet(); @Bean public SpringTemplateEngine templateEngine() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java index 1ea7f46973..afcae7fc4e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java @@ -50,7 +50,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp */ public class HttpMessageConverters implements Iterable> { - private List> converters; + private final List> converters; /** * Create a new {@link HttpMessageConverters} instance with the specified additional diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java index b38320aaea..591436fa40 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java @@ -50,7 +50,7 @@ import com.fasterxml.jackson.datatype.joda.JodaModule; public class HttpMessageConvertersAutoConfiguration { @Autowired(required = false) - private List> converters = Collections.emptyList(); + private final List> converters = Collections.emptyList(); @Bean @ConditionalOnMissingBean diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index 7379bcb4c5..f820753cb7 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -56,7 +56,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer { @NotNull private String contextPath = ""; - private Tomcat tomcat = new Tomcat(); + private final Tomcat tomcat = new Tomcat(); public Tomcat getTomcat() { return this.tomcat; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.java index 8b9e15c159..fe1d51469c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.java @@ -69,7 +69,7 @@ public class WebSocketAutoConfiguration { protected static class WebSocketRegistrationConfiguration implements BeanPostProcessor, BeanFactoryAware, WebSocketConfigurer { - private Map prefixes = new HashMap(); + private final Map prefixes = new HashMap(); private ListableBeanFactory beanFactory; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/PropertyPlaceholderAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/PropertyPlaceholderAutoConfigurationTests.java index cccb008c20..146694ad9a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/PropertyPlaceholderAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/PropertyPlaceholderAutoConfigurationTests.java @@ -35,7 +35,7 @@ import static org.junit.Assert.assertEquals; */ public class PropertyPlaceholderAutoConfigurationTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @After public void close() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java index 3f9a75cd49..c2a2822f45 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java @@ -29,7 +29,7 @@ import static org.junit.Assert.assertEquals; */ public class JobExecutionExitCodeGeneratorTests { - private JobExecutionExitCodeGenerator generator = new JobExecutionExitCodeGenerator(); + private final JobExecutionExitCodeGenerator generator = new JobExecutionExitCodeGenerator(); @Test public void testExitCodeForRunning() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java index fa31786529..49570d6d3f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java @@ -37,7 +37,7 @@ import static org.junit.Assert.assertTrue; */ public class ConditionalOnBeanTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void testNameOnBeanCondition() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnClassTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnClassTests.java index e27c7c1409..262b2f3046 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnClassTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnClassTests.java @@ -34,7 +34,7 @@ import static org.junit.Assert.assertTrue; */ public class ConditionalOnClassTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void testVanillaOnClassCondition() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnExpressionTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnExpressionTests.java index 6808488025..f2c02c2c7c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnExpressionTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnExpressionTests.java @@ -32,7 +32,7 @@ import static org.junit.Assert.assertTrue; */ public class ConditionalOnExpressionTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void testResourceExists() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java index 1848afb127..6cdd22cacb 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java @@ -41,7 +41,7 @@ import static org.junit.Assert.assertTrue; @SuppressWarnings("resource") public class ConditionalOnMissingBeanTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void testNameOnMissingBeanCondition() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingClassTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingClassTests.java index dc8d3bdf1b..b3c3fed613 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingClassTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingClassTests.java @@ -32,7 +32,7 @@ import static org.junit.Assert.assertTrue; */ public class ConditionalOnMissingClassTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void testVanillaOnClassCondition() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnNotWebApplicationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnNotWebApplicationTests.java index 78d2d4b051..8802df953e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnNotWebApplicationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnNotWebApplicationTests.java @@ -32,7 +32,7 @@ import static org.junit.Assert.assertTrue; */ public class ConditionalOnNotWebApplicationTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void testWebApplication() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnResourceTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnResourceTests.java index cadd95fece..f4384190fa 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnResourceTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnResourceTests.java @@ -32,7 +32,7 @@ import static org.junit.Assert.assertTrue; */ public class ConditionalOnResourceTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void testResourceExists() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnWebApplicationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnWebApplicationTests.java index 391d28df34..a4c566ee3f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnWebApplicationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnWebApplicationTests.java @@ -33,7 +33,7 @@ import static org.junit.Assert.assertTrue; */ public class ConditionalOnWebApplicationTests { - private AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); + private final AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); @Test public void testWebApplication() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDataSourceConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDataSourceConfigurationTests.java index 1a75c527c2..358c76342d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDataSourceConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDataSourceConfigurationTests.java @@ -30,7 +30,7 @@ import static org.junit.Assert.assertNotNull; */ public class CommonsDataSourceConfigurationTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void testDataSourceExists() throws Exception { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java index a4b1c736ee..0188d16df7 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java @@ -54,7 +54,7 @@ import static org.junit.Assert.assertTrue; */ public class DataSourceAutoConfigurationTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void testDefaultDataSourceExists() throws Exception { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java index 6ac81d730a..f85e4be1ae 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java @@ -33,7 +33,7 @@ import static org.junit.Assert.assertNotNull; */ public class DataSourceTransactionManagerAutoConfigurationTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void testDataSourceExists() throws Exception { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java index 721348e75f..d79f285fe8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java @@ -38,7 +38,7 @@ import static org.junit.Assert.assertNotNull; */ public class TomcatDataSourceConfigurationTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @After public void restore() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java index 8de7a1f0bd..dd0b38d558 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java @@ -28,7 +28,7 @@ import static org.junit.Assert.assertNotNull; */ public class ReactorAutoConfigurationTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test public void reactorIsAvailable() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 1737446525..5524db4b4f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.verify; */ public class ServerPropertiesTests { - private ServerProperties properties = new ServerProperties(); + private final ServerProperties properties = new ServerProperties(); @Test public void testAddressBinding() throws Exception { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/OptionParsingCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/OptionParsingCommand.java index 769400ce52..8261eebfaa 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/OptionParsingCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/OptionParsingCommand.java @@ -27,7 +27,7 @@ import java.util.Collection; */ public abstract class OptionParsingCommand extends AbstractCommand { - private OptionHandler handler; + private final OptionHandler handler; protected OptionParsingCommand(String name, String description, OptionHandler handler) { super(name, description); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/SourceOptions.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/SourceOptions.java index 22a4f634a6..00212f7944 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/SourceOptions.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/SourceOptions.java @@ -33,9 +33,9 @@ import org.springframework.boot.cli.util.ResourceUtils; */ public class SourceOptions { - private List sources; + private final List sources; - private List args; + private final List args; /** * Create a new {@link SourceOptions} instance. diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/AnsiString.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/AnsiString.java index 1a0b3f43cf..580691687e 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/AnsiString.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/AnsiString.java @@ -30,7 +30,7 @@ class AnsiString { private final Terminal terminal; - private StringBuilder value = new StringBuilder(); + private final StringBuilder value = new StringBuilder(); /** * Create a new {@link AnsiString} for the given {@link Terminal}. diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java index 6ac752c0e3..e169da6cc5 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java @@ -44,9 +44,9 @@ public class CommandCompleter extends StringsCompleter { private final Map commandCompleters = new HashMap(); - private List commands = new ArrayList(); + private final List commands = new ArrayList(); - private ConsoleReader console; + private final ConsoleReader console; public CommandCompleter(ConsoleReader consoleReader, ArgumentDelimiter argumentDelimiter, Iterable commands) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java index e0f67fe702..f30cc944ca 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java @@ -62,13 +62,13 @@ public class Shell { private static final String DEFAULT_PROMPT = "$ "; - private ShellCommandRunner commandRunner; + private final ShellCommandRunner commandRunner; - private ConsoleReader consoleReader; + private final ConsoleReader consoleReader; - private EscapeAwareWhiteSpaceArgumentDelimiter argumentDelimiter = new EscapeAwareWhiteSpaceArgumentDelimiter(); + private final EscapeAwareWhiteSpaceArgumentDelimiter argumentDelimiter = new EscapeAwareWhiteSpaceArgumentDelimiter(); - private Stack prompts = new Stack(); + private final Stack prompts = new Stack(); /** * Create a new {@link Shell} instance. diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/transformation/GroovyBeansTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/transformation/GroovyBeansTransformation.java index 095bf6b190..82a0220047 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/transformation/GroovyBeansTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/transformation/GroovyBeansTransformation.java @@ -65,7 +65,7 @@ public class GroovyBeansTransformation implements ASTTransformation { private static final String SOURCE_INTERFACE = "org.springframework.boot.BeanDefinitionLoader.GroovyBeanDefinitionSource"; private static final String BEANS = "beans"; private final SourceUnit source; - private ClassNode classNode; + private final ClassNode classNode; private boolean xformed = false; public ClassVisitor(SourceUnit source, ClassNode classNode) { diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java index 6fceb1e8f0..8bd6b39f9f 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java @@ -48,13 +48,13 @@ import org.springframework.boot.cli.util.OutputCapture; */ public class CliTester implements TestRule { - private OutputCapture outputCapture = new OutputCapture(); + private final OutputCapture outputCapture = new OutputCapture(); private long timeout = TimeUnit.MINUTES.toMillis(6); - private List commands = new ArrayList(); + private final List commands = new ArrayList(); - private String prefix; + private final String prefix; public CliTester(String prefix) { this.prefix = prefix; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CommandRunnerTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CommandRunnerTests.java index 2704d32b0f..097b8bf2b2 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CommandRunnerTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CommandRunnerTests.java @@ -56,7 +56,7 @@ public class CommandRunnerTests { @Mock private Command anotherCommand; - private Set calls = EnumSet.noneOf(Call.class); + private final Set calls = EnumSet.noneOf(Call.class); private ClassLoader loader; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java index 536ef394f4..4fe0a32ca2 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java @@ -30,7 +30,7 @@ import static org.junit.Assert.assertThat; */ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { - private EscapeAwareWhiteSpaceArgumentDelimiter delimiter = new EscapeAwareWhiteSpaceArgumentDelimiter(); + private final EscapeAwareWhiteSpaceArgumentDelimiter delimiter = new EscapeAwareWhiteSpaceArgumentDelimiter(); @Test public void simple() throws Exception { diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java index 3af7204e71..fabe2daeb6 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java @@ -28,13 +28,13 @@ public class HotelSummary implements Serializable { private static final MathContext MATH_CONTEXT = new MathContext(2, RoundingMode.HALF_UP); - private City city; + private final City city; - private String name; + private final String name; - private Double averageRating; + private final Double averageRating; - private Integer averageRatingRounded; + private final Integer averageRatingRounded; public HotelSummary(City city, String name, Double averageRating) { this.city = city; diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/RatingCount.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/RatingCount.java index 5b1471eb22..e81c7ae1fb 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/RatingCount.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/RatingCount.java @@ -22,9 +22,9 @@ public class RatingCount implements Serializable { private static final long serialVersionUID = 1L; - private Rating rating; + private final Rating rating; - private long count; + private final long count; public RatingCount(Rating rating, long count) { this.rating = rating; diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java index 83c7461181..e3ea7f0d65 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java @@ -82,7 +82,7 @@ class HotelServiceImpl implements HotelService { private static class ReviewsSummaryImpl implements ReviewsSummary { - private Map ratingCount; + private final Map ratingCount; public ReviewsSummaryImpl(List ratingCounts) { this.ratingCount = new HashMap(); diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/InMemoryMessageRespository.java b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/InMemoryMessageRespository.java index 074a961167..b112448c92 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/InMemoryMessageRespository.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/InMemoryMessageRespository.java @@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicLong; public class InMemoryMessageRespository implements MessageRepository { private static AtomicLong counter = new AtomicLong(); - private ConcurrentMap messages = new ConcurrentHashMap(); + private final ConcurrentMap messages = new ConcurrentHashMap(); @Override public Iterable findAll() { diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/mvc/MessageController.java b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/mvc/MessageController.java index d0f8cc0226..aacd5c78e0 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/mvc/MessageController.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/mvc/MessageController.java @@ -34,7 +34,7 @@ import sample.ui.MessageRepository; @Controller @RequestMapping("/") public class MessageController { - private MessageRepository messageRepository; + private final MessageRepository messageRepository; @Autowired public MessageController(MessageRepository messageRepository) { diff --git a/spring-boot-samples/spring-boot-sample-websocket/src/main/java/samples/websocket/client/SimpleClientWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket/src/main/java/samples/websocket/client/SimpleClientWebSocketHandler.java index 0aa8a9488e..1b3dc4ef89 100644 --- a/spring-boot-samples/spring-boot-sample-websocket/src/main/java/samples/websocket/client/SimpleClientWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket/src/main/java/samples/websocket/client/SimpleClientWebSocketHandler.java @@ -31,7 +31,7 @@ public class SimpleClientWebSocketHandler extends TextWebSocketHandler { private final GreetingService greetingService; - private CountDownLatch latch; + private final CountDownLatch latch; @Autowired public SimpleClientWebSocketHandler(GreetingService greetingService, diff --git a/spring-boot-samples/spring-boot-sample-websocket/src/test/java/samples/websocket/echo/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket/src/test/java/samples/websocket/echo/SampleWebSocketsApplicationTests.java index 36a783aefb..788e015f3f 100644 --- a/spring-boot-samples/spring-boot-sample-websocket/src/test/java/samples/websocket/echo/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket/src/test/java/samples/websocket/echo/SampleWebSocketsApplicationTests.java @@ -83,7 +83,7 @@ public class SampleWebSocketsApplicationTests { @Configuration static class ClientConfiguration implements CommandLineRunner { - private CountDownLatch latch = new CountDownLatch(1); + private final CountDownLatch latch = new CountDownLatch(1); @Override public void run(String... args) throws Exception { diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java index 60f90fd591..8af0572062 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java @@ -222,7 +222,7 @@ class JarWriter { private static final byte[] ZIP_HEADER = new byte[] { 0x50, 0x4b, 0x03, 0x04 }; - private byte[] header; + private final byte[] header; private ByteArrayInputStream headerStream; diff --git a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java index 7e42d96fef..a20671d726 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java @@ -36,9 +36,9 @@ public class TestJarFile { private final byte[] buffer = new byte[4096]; - private TemporaryFolder temporaryFolder; + private final TemporaryFolder temporaryFolder; - private File jarSource; + private final File jarSource; public TestJarFile(TemporaryFolder temporaryFolder) throws IOException { this.temporaryFolder = temporaryFolder; diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java index 3977a21172..fcd164a7e8 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java @@ -26,9 +26,9 @@ import java.lang.reflect.Method; */ public class MainMethodRunner implements Runnable { - private String mainClassName; + private final String mainClassName; - private String[] args; + private final String[] args; /** * Create a new {@link MainMethodRunner} instance. diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java index dfff61afae..a40b62ccbd 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java @@ -76,7 +76,7 @@ import org.springframework.boot.loader.util.SystemPropertyUtils; */ public class PropertiesLauncher extends Launcher { - private Logger logger = Logger.getLogger(Launcher.class.getName()); + private final Logger logger = Logger.getLogger(Launcher.class.getName()); /** * Properties key for main class @@ -125,7 +125,7 @@ public class PropertiesLauncher extends Launcher { private List paths = new ArrayList(DEFAULT_PATHS); - private Properties properties = new Properties(); + private final Properties properties = new Properties(); public PropertiesLauncher() { if (!isDebug()) { diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java index df3080ae52..763a34f97f 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java @@ -50,7 +50,7 @@ public class ExplodedArchive extends Archive { private static final AsciiBytes MANIFEST_ENTRY_NAME = new AsciiBytes( "META-INF/MANIFEST.MF"); - private File root; + private final File root; private Map entries = new LinkedHashMap(); @@ -200,7 +200,7 @@ public class ExplodedArchive extends Archive { */ private static class FileNotFoundURLConnection extends URLConnection { - private String name; + private final String name; public FileNotFoundURLConnection(URL url, String name) { super(url); diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/FilteredArchive.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/FilteredArchive.java index 4ed025a9b4..7e4d6e4848 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/FilteredArchive.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/FilteredArchive.java @@ -34,9 +34,9 @@ import org.springframework.boot.loader.AsciiBytes; */ public class FilteredArchive extends Archive { - private Archive parent; + private final Archive parent; - private EntryFilter filter; + private final EntryFilter filter; public FilteredArchive(Archive parent, EntryFilter filter) { this.parent = parent; diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java index d09d88b290..492b81b543 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java @@ -229,7 +229,7 @@ public class RandomAccessDataFile implements RandomAccessData { */ private class FilePool { - private int size; + private final int size; private final Semaphore available; diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryData.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryData.java index 455143f1bb..01a68eda0b 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryData.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryData.java @@ -39,7 +39,7 @@ public final class JarEntryData { private final JarFile source; - private byte[] header; + private final byte[] header; private AsciiBytes name; @@ -47,7 +47,7 @@ public final class JarEntryData { private final AsciiBytes comment; - private long localHeaderOffset; + private final long localHeaderOffset; private RandomAccessData data; diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java index ba7a08da8c..fec690ba44 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java @@ -65,7 +65,7 @@ public class JarFile extends java.util.jar.JarFile implements Iterable { - private byte[] bytes; + private final byte[] bytes; public ByteArrayStartsWith(byte[] bytes) { this.bytes = bytes; diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java index 1194c0363e..e99ea84d0c 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java @@ -38,7 +38,7 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer // Set this in pom configuration with ... private String resource; - private Properties data = new Properties(); + private final Properties data = new Properties(); /** * @return the data the properties being merged diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java index de66230cf5..36fa4cc18e 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java @@ -150,7 +150,7 @@ public class RepackageMojo extends AbstractMojo { public static enum LayoutType { JAR(new Layouts.Jar()), WAR(new Layouts.War()), ZIP(new Layouts.Expanded()), DIR( new Layouts.Expanded()), NONE(new Layouts.None()); - private Layout layout; + private final Layout layout; public Layout layout() { return this.layout; diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java index 323fabf559..00375d8f70 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java @@ -228,8 +228,8 @@ public class RunMojo extends AbstractMojo { */ class LaunchRunner implements Runnable { - private String startClassName; - private String[] args; + private final String startClassName; + private final String[] args; public LaunchRunner(String startClassName, String... args) { this.startClassName = startClassName; diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/PropertiesMergingResourceTransformerTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/PropertiesMergingResourceTransformerTests.java index 818ef10fbf..02ac1326ed 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/PropertiesMergingResourceTransformerTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/PropertiesMergingResourceTransformerTests.java @@ -34,7 +34,7 @@ import static org.junit.Assert.assertTrue; */ public class PropertiesMergingResourceTransformerTests { - private PropertiesMergingResourceTransformer transformer = new PropertiesMergingResourceTransformer(); + private final PropertiesMergingResourceTransformer transformer = new PropertiesMergingResourceTransformer(); @Test public void testProcess() throws Exception { diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java index dd7e879cb2..84a3ff75e2 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java @@ -52,7 +52,7 @@ public class Verify { private static abstract class AbstractArchiveVerification { - private File file; + private final File file; public AbstractArchiveVerification(File file) { this.file = file; @@ -98,7 +98,7 @@ public class Verify { private static class JarArchiveVerification extends AbstractArchiveVerification { - private String main; + private final String main; public JarArchiveVerification(File file, String main) { super(file); diff --git a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java index fff74ab6ab..bef13950b9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java @@ -56,15 +56,15 @@ class BeanDefinitionLoader { private static final ResourceLoader DEFAULT_RESOURCE_LOADER = new PathMatchingResourcePatternResolver(); - private Object[] sources; + private final Object[] sources; - private AnnotatedBeanDefinitionReader annotatedReader; + private final AnnotatedBeanDefinitionReader annotatedReader; - private XmlBeanDefinitionReader xmlReader; + private final XmlBeanDefinitionReader xmlReader; private GroovyBeanDefinitionReader groovyReader; - private ClassPathBeanDefinitionScanner scanner; + private final ClassPathBeanDefinitionScanner scanner; private ResourceLoader resourceLoader; @@ -286,7 +286,7 @@ class BeanDefinitionLoader { */ private static class ClassExcludeFilter extends AbstractTypeHierarchyTraversingFilter { - private Set classNames = new HashSet(); + private final Set classNames = new HashSet(); public ClassExcludeFilter(Object... sources) { super(false, false); diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 6e6c285d50..fec88304b3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -157,7 +157,7 @@ public class SpringApplication { private final Log log = LogFactory.getLog(getClass()); - private Set sources = new LinkedHashSet(); + private final Set sources = new LinkedHashSet(); private Class mainApplicationClass; diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBeforeRefreshEvent.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBeforeRefreshEvent.java index 449fee45db..25e14e4acd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBeforeRefreshEvent.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBeforeRefreshEvent.java @@ -30,8 +30,8 @@ import org.springframework.core.env.Environment; */ public class SpringApplicationBeforeRefreshEvent extends ApplicationEvent { - private String[] args; - private ConfigurableApplicationContext context; + private final String[] args; + private final ConfigurableApplicationContext context; /** * @param springApplication the current application diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationEnvironmentAvailableEvent.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationEnvironmentAvailableEvent.java index ac9e80be13..f9e904becb 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationEnvironmentAvailableEvent.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationEnvironmentAvailableEvent.java @@ -28,8 +28,8 @@ import org.springframework.core.env.Environment; */ public class SpringApplicationEnvironmentAvailableEvent extends ApplicationEvent { - private ConfigurableEnvironment environment; - private String[] args; + private final ConfigurableEnvironment environment; + private final String[] args; /** * @param springApplication the current application diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationErrorEvent.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationErrorEvent.java index 6c9e14f6ab..d7ead8bd5e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationErrorEvent.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationErrorEvent.java @@ -26,9 +26,9 @@ import org.springframework.context.ConfigurableApplicationContext; */ public class SpringApplicationErrorEvent extends ApplicationEvent { - private String[] args; - private Throwable exception; - private ConfigurableApplicationContext context; + private final String[] args; + private final Throwable exception; + private final ConfigurableApplicationContext context; /** * @param springApplication the current application diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationStartEvent.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationStartEvent.java index 4ea2d60097..9481e9b38b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationStartEvent.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationStartEvent.java @@ -32,7 +32,7 @@ import org.springframework.core.env.Environment; */ public class SpringApplicationStartEvent extends ApplicationEvent { - private String[] args; + private final String[] args; /** * @param springApplication the current application diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java index 8ccf9ac5b5..487c3bd338 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java @@ -62,7 +62,7 @@ public class PropertiesConfigurationFactory implements FactoryBean, private PropertySources propertySources; - private T target; + private final T target; private Validator validator; diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java index 618fead9a4..0bbbfcc8e3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java @@ -41,11 +41,11 @@ import org.springframework.validation.DataBinder; */ public class PropertySourcesPropertyValues implements PropertyValues { - private Map propertyValues = new ConcurrentHashMap(); + private final Map propertyValues = new ConcurrentHashMap(); - private PropertySources propertySources; + private final PropertySources propertySources; - private Collection NON_ENUMERABLE_ENUMERABLES = Arrays.asList( + private final Collection NON_ENUMERABLE_ENUMERABLES = Arrays.asList( StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java index 64a3cc37e8..8e1d88c472 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java @@ -34,7 +34,7 @@ public final class RelaxedNames implements Iterable { private final String name; - private Set values = new LinkedHashSet(); + private final Set values = new LinkedHashSet(); /** * Create a new {@link RelaxedNames} instance. diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java b/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java index 787d7c2574..e0614a9942 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java @@ -52,7 +52,7 @@ public class YamlConfigurationFactory implements FactoryBean, MessageSourc private final Log logger = LogFactory.getLog(getClass()); - private Class type; + private final Class type; private boolean exceptionIfInvalid; diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java b/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java index 9c39a7d143..7f0157adc1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java @@ -63,17 +63,17 @@ import org.springframework.core.io.ResourceLoader; */ public class SpringApplicationBuilder { - private SpringApplication application; + private final SpringApplication application; private ConfigurableApplicationContext context; private SpringApplicationBuilder parent; - private AtomicBoolean running = new AtomicBoolean(false); + private final AtomicBoolean running = new AtomicBoolean(false); - private Set sources = new LinkedHashSet(); + private final Set sources = new LinkedHashSet(); - private Map defaultProperties = new LinkedHashMap(); + private final Map defaultProperties = new LinkedHashMap(); private ConfigurableEnvironment environment; diff --git a/spring-boot/src/main/java/org/springframework/boot/config/ArrayDocumentMatcher.java b/spring-boot/src/main/java/org/springframework/boot/config/ArrayDocumentMatcher.java index 492e19262e..58eaa54b56 100644 --- a/spring-boot/src/main/java/org/springframework/boot/config/ArrayDocumentMatcher.java +++ b/spring-boot/src/main/java/org/springframework/boot/config/ArrayDocumentMatcher.java @@ -32,9 +32,9 @@ import org.springframework.util.StringUtils; */ public class ArrayDocumentMatcher implements DocumentMatcher { - private String key; + private final String key; - private String[] patterns; + private final String[] patterns; public ArrayDocumentMatcher(final String key, final String... patterns) { this.key = key; diff --git a/spring-boot/src/main/java/org/springframework/boot/config/YamlPropertySourceLoader.java b/spring-boot/src/main/java/org/springframework/boot/config/YamlPropertySourceLoader.java index 66d117b8e1..63e607aa48 100644 --- a/spring-boot/src/main/java/org/springframework/boot/config/YamlPropertySourceLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/config/YamlPropertySourceLoader.java @@ -35,7 +35,7 @@ import org.springframework.util.StringUtils; */ public class YamlPropertySourceLoader extends PropertiesPropertySourceLoader { - private List matchers; + private final List matchers; /** * Create a {@link YamlPropertySourceLoader} instance with the specified matchers. diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerInitializedEvent.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerInitializedEvent.java index 0019f8b5d8..cf2b6af5f4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerInitializedEvent.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerInitializedEvent.java @@ -29,7 +29,7 @@ import org.springframework.context.ApplicationEvent; */ public class EmbeddedServletContainerInitializedEvent extends ApplicationEvent { - private ApplicationContext applicationContext; + private final ApplicationContext applicationContext; public EmbeddedServletContainerInitializedEvent( ApplicationContext applicationContext, EmbeddedServletContainer source) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ErrorPage.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ErrorPage.java index fbe908703b..642a811d30 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ErrorPage.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ErrorPage.java @@ -27,7 +27,7 @@ import org.springframework.util.ObjectUtils; */ public class ErrorPage { - private String path; + private final String path; private Class exception = null; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java index 755b1a229b..710bb69c92 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java @@ -40,7 +40,7 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { private final Log logger = LogFactory.getLog(JettyEmbeddedServletContainer.class); private final Server server; - private boolean autoStart; + private final boolean autoStart; /** * Create a new {@link JettyEmbeddedServletContainer} instance. diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/ServletContextInitializerConfiguration.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/ServletContextInitializerConfiguration.java index d18d61b182..5f917d9cd0 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/ServletContextInitializerConfiguration.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/ServletContextInitializerConfiguration.java @@ -33,9 +33,9 @@ import org.springframework.util.Assert; */ public class ServletContextInitializerConfiguration extends AbstractConfiguration { - private ContextHandler contextHandler; + private final ContextHandler contextHandler; - private ServletContextInitializer[] initializers; + private final ServletContextInitializer[] initializers; /** * Create a new {@link ServletContextInitializerConfiguration}. diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java index 0a3e65e93e..4bcc8496e0 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java @@ -32,7 +32,7 @@ import org.springframework.util.Assert; */ public class ServletContextInitializerLifecycleListener implements LifecycleListener { - private ServletContextInitializer[] initializers; + private final ServletContextInitializer[] initializers; /** * Create a new {@link ServletContextInitializerLifecycleListener} instance with the diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java index 268c08430c..e2decf8547 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java @@ -47,7 +47,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer private final Tomcat tomcat; - private boolean autoStart; + private final boolean autoStart; /** * Create a new {@link TomcatEmbeddedServletContainer} instance. diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java index 2a68c18809..34552999b2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java @@ -420,11 +420,11 @@ public class TomcatEmbeddedServletContainerFactory extends private static class TomcatErrorPage { - private String location; - private String exceptionType; - private int errorCode; + private final String location; + private final String exceptionType; + private final int errorCode; - private Object nativePage; + private final Object nativePage; public TomcatErrorPage(ErrorPage errorPage) { this.location = errorPage.getPath(); @@ -487,7 +487,7 @@ public class TomcatEmbeddedServletContainerFactory extends */ private static class StoreMergedWebXmlListener implements LifecycleListener { - private String MERGED_WEB_XML = org.apache.tomcat.util.scan.Constants.MERGED_WEB_XML; + private final String MERGED_WEB_XML = org.apache.tomcat.util.scan.Constants.MERGED_WEB_XML; @Override public void lifecycleEvent(LifecycleEvent event) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/initializer/ContextIdApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/initializer/ContextIdApplicationContextInitializer.java index 89dfe7942d..98cba8cc10 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/initializer/ContextIdApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/initializer/ContextIdApplicationContextInitializer.java @@ -59,7 +59,7 @@ public class ContextIdApplicationContextInitializer implements */ private static final String INDEX_PATTERN = "${vcap.application.instance_index:${spring.application.index:${server.port:${PORT:null}}}}"; - private String name; + private final String name; private int order = Integer.MAX_VALUE - 10; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/initializer/ParentContextApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/initializer/ParentContextApplicationContextInitializer.java index 03de0c5190..719de7ce82 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/initializer/ParentContextApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/initializer/ParentContextApplicationContextInitializer.java @@ -31,7 +31,7 @@ public class ParentContextApplicationContextInitializer implements private int order = Integer.MIN_VALUE; - private ApplicationContext parent; + private final ApplicationContext parent; public ParentContextApplicationContextInitializer(ApplicationContext parent) { this.parent = parent; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/initializer/ServletContextApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/initializer/ServletContextApplicationContextInitializer.java index 058dedf8f7..3f175f3a54 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/initializer/ServletContextApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/initializer/ServletContextApplicationContextInitializer.java @@ -32,7 +32,7 @@ public class ServletContextApplicationContextInitializer implements private int order = Integer.MIN_VALUE; - private ServletContext servletContext; + private final ServletContext servletContext; /** * @param servletContext diff --git a/spring-boot/src/main/java/org/springframework/boot/context/listener/ConfigFileApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/listener/ConfigFileApplicationListener.java index 07808c5aa6..0b90e807ac 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/listener/ConfigFileApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/listener/ConfigFileApplicationListener.java @@ -98,11 +98,11 @@ public class ConfigFileApplicationListener implements private int order = Integer.MIN_VALUE + 10; - private Map> cached = new HashMap>(); + private final Map> cached = new HashMap>(); - private ConversionService conversionService = new DefaultConversionService(); + private final ConversionService conversionService = new DefaultConversionService(); - private PropertySourceAnnotations propertySourceAnnotations = new PropertySourceAnnotations(); + private final PropertySourceAnnotations propertySourceAnnotations = new PropertySourceAnnotations(); private PropertySourceLoaderFactory propertySourceLoaderFactory = new DefaultPropertySourceLoaderFactory(); @@ -411,13 +411,13 @@ public class ConfigFileApplicationListener implements private static class PropertySourceAnnotations { - private Collection locations = new LinkedHashSet(); + private final Collection locations = new LinkedHashSet(); - private Map names = new HashMap(); + private final Map names = new HashMap(); - private Map> configs = new HashMap>(); + private final Map> configs = new HashMap>(); - private Map ignores = new HashMap(); + private final Map ignores = new HashMap(); public void add(Class source, String[] locations, boolean ignoreResourceNotFound, String name) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/listener/VcapApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/listener/VcapApplicationListener.java index 8d972362c9..ffa3c23801 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/listener/VcapApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/listener/VcapApplicationListener.java @@ -101,7 +101,7 @@ public class VcapApplicationListener implements // use these ones private int order = Integer.MIN_VALUE + 9; - private JsonParser parser = JsonParserFactory.getJsonParser(); + private final JsonParser parser = JsonParserFactory.getJsonParser(); public void setOrder(int order) { this.order = order; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java index bd749c7843..75c45472af 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -78,11 +78,11 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc private ConversionService conversionService; - private DefaultConversionService defaultConversionService = new DefaultConversionService(); + private final DefaultConversionService defaultConversionService = new DefaultConversionService(); private BeanFactory beanFactory; - private boolean initialized = false; + private final boolean initialized = false; private ResourceLoader resourceLoader = new DefaultResourceLoader(); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesHolder.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesHolder.java index eff0f2fbd2..0ac26355a5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesHolder.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesHolder.java @@ -24,7 +24,7 @@ package org.springframework.boot.context.properties; */ class ConfigurationPropertiesHolder { - private Object target; + private final Object target; public ConfigurationPropertiesHolder(Object target) { this.target = target; diff --git a/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java b/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java index 2735b87606..05d6e78a52 100644 --- a/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java @@ -83,7 +83,7 @@ public class OverrideSourcesTests { protected static class TestBean { - private String name; + private final String name; public TestBean(String name) { this.name = name; diff --git a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index 56562aa019..abf8f96a50 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -521,13 +521,13 @@ public class SpringApplicationTests { static class TestCommandLineRunner implements CommandLineRunner, ApplicationContextAware, Ordered { - private String[] expectedBefore; + private final String[] expectedBefore; private ApplicationContext applicationContext; private String[] args; - private int order; + private final int order; public TestCommandLineRunner(int order, String... expectedBefore) { this.expectedBefore = expectedBefore; diff --git a/spring-boot/src/test/java/org/springframework/boot/StartUpLoggerTests.java b/spring-boot/src/test/java/org/springframework/boot/StartUpLoggerTests.java index aa98d246e1..80c0a53653 100644 --- a/spring-boot/src/test/java/org/springframework/boot/StartUpLoggerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/StartUpLoggerTests.java @@ -28,9 +28,9 @@ import static org.junit.Assert.assertTrue; */ public class StartUpLoggerTests { - private StringBuffer output = new StringBuffer(); + private final StringBuffer output = new StringBuffer(); - private SimpleLog log = new SimpleLog("test") { + private final SimpleLog log = new SimpleLog("test") { @Override protected void write(StringBuffer buffer) { StartUpLoggerTests.this.output.append(buffer).append("\n"); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java index c8a1273c23..780b15b4cb 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java @@ -34,7 +34,7 @@ import static org.junit.Assert.assertEquals; */ public class PropertySourcesPropertyValuesTests { - private MutablePropertySources propertySources = new MutablePropertySources(); + private final MutablePropertySources propertySources = new MutablePropertySources(); @Before public void init() { diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java index 709601673e..53fa188011 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java @@ -538,7 +538,7 @@ public class RelaxedDataBinderTests { } public static class TargetWithReadOnlyNestedList { - private List nested = new ArrayList(); + private final List nested = new ArrayList(); public List getNested() { return this.nested; @@ -546,7 +546,7 @@ public class RelaxedDataBinderTests { } public static class TargetWithReadOnlyNestedCollection { - private Collection nested = new ArrayList(); + private final Collection nested = new ArrayList(); public Collection getNested() { return this.nested; diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java index 749a248131..576341b8cd 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java @@ -41,7 +41,7 @@ public class YamlConfigurationFactoryTests { private Validator validator; - private Map, Map> aliases = new HashMap, Map>(); + private final Map, Map> aliases = new HashMap, Map>(); private Foo createFoo(final String yaml) throws Exception { YamlConfigurationFactory factory = new YamlConfigurationFactory( diff --git a/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java b/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java index fb4a8a3a99..0721591403 100644 --- a/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java @@ -215,7 +215,7 @@ public class SpringApplicationBuilderTests { public static class SpyApplicationContext extends AnnotationConfigApplicationContext { - private ConfigurableApplicationContext applicationContext = spy(new AnnotationConfigApplicationContext()); + private final ConfigurableApplicationContext applicationContext = spy(new AnnotationConfigApplicationContext()); private ResourceLoader resourceLoader; @Override diff --git a/spring-boot/src/test/java/org/springframework/boot/config/SimpleJsonParserTests.java b/spring-boot/src/test/java/org/springframework/boot/config/SimpleJsonParserTests.java index 6190e6099c..d7ba93d98a 100644 --- a/spring-boot/src/test/java/org/springframework/boot/config/SimpleJsonParserTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/config/SimpleJsonParserTests.java @@ -30,7 +30,7 @@ import static org.junit.Assert.assertEquals; */ public class SimpleJsonParserTests { - private JsonParser parser = getParser(); + private final JsonParser parser = getParser(); protected JsonParser getParser() { return new SimpleJsonParser(); diff --git a/spring-boot/src/test/java/org/springframework/boot/config/YamlMapFactoryBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/config/YamlMapFactoryBeanTests.java index dad98d3228..8bffe4cb07 100644 --- a/spring-boot/src/test/java/org/springframework/boot/config/YamlMapFactoryBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/config/YamlMapFactoryBeanTests.java @@ -38,7 +38,7 @@ import static org.junit.Assert.assertTrue; */ public class YamlMapFactoryBeanTests { - private YamlMapFactoryBean factory = new YamlMapFactoryBean(); + private final YamlMapFactoryBean factory = new YamlMapFactoryBean(); @Test public void testSetIgnoreResourceNotFound() throws Exception { diff --git a/spring-boot/src/test/java/org/springframework/boot/config/YamlProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/config/YamlProcessorTests.java index e5446be6ca..d593f7f758 100644 --- a/spring-boot/src/test/java/org/springframework/boot/config/YamlProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/config/YamlProcessorTests.java @@ -36,7 +36,7 @@ import static org.junit.Assert.assertEquals; */ public class YamlProcessorTests { - private YamlProcessor processor = new YamlProcessor(); + private final YamlProcessor processor = new YamlProcessor(); @Rule public ExpectedException exception = ExpectedException.none(); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/FilterRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/FilterRegistrationBeanTests.java index 88df4a737b..8484171bb4 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/FilterRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/FilterRegistrationBeanTests.java @@ -48,7 +48,7 @@ public class FilterRegistrationBeanTests { @Rule public ExpectedException thrown = ExpectedException.none(); - private MockFilter filter = new MockFilter(); + private final MockFilter filter = new MockFilter(); @Mock private ServletContext servletContext; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java index 7f978e5db6..8e328ab066 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java @@ -77,13 +77,13 @@ public class MockEmbeddedServletContainerFactory extends private ServletContext servletContext; - private ServletContextInitializer[] initializers; + private final ServletContextInitializer[] initializers; - private List registeredServlets = new ArrayList(); + private final List registeredServlets = new ArrayList(); - private List registeredFilters = new ArrayList(); + private final List registeredFilters = new ArrayList(); - private int port; + private final int port; public MockEmbeddedServletContainer(ServletContextInitializer[] initializers, int port) { @@ -187,9 +187,9 @@ public class MockEmbeddedServletContainerFactory extends public static class RegisteredServlet { - private Servlet servlet; + private final Servlet servlet; - private ServletRegistration.Dynamic registration; + private final ServletRegistration.Dynamic registration; public RegisteredServlet(Servlet servlet) { this.servlet = servlet; @@ -207,9 +207,9 @@ public class MockEmbeddedServletContainerFactory extends public static class RegisteredFilter { - private Filter filter; + private final Filter filter; - private FilterRegistration.Dynamic registration; + private final FilterRegistration.Dynamic registration; public RegisteredFilter(Filter filter) { this.filter = filter; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java index 4371c4c344..181db38994 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java @@ -41,7 +41,7 @@ public class ServletListenerRegistrationBeanTests { @Rule public ExpectedException thrown = ExpectedException.none(); - private ServletContextListener listener = Mockito.mock(ServletContextListener.class); + private final ServletContextListener listener = Mockito.mock(ServletContextListener.class); @Mock private ServletContext servletContext; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletRegistrationBeanTests.java index 02cebe97ae..9dd5887c93 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletRegistrationBeanTests.java @@ -50,7 +50,7 @@ public class ServletRegistrationBeanTests { @Rule public ExpectedException thrown = ExpectedException.none(); - private MockServlet servlet = new MockServlet(); + private final MockServlet servlet = new MockServlet(); @Mock private ServletContext servletContext; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/initializer/ContextIdApplicationContextInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/initializer/ContextIdApplicationContextInitializerTests.java index 74a50c0b07..fd6aa2beeb 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/initializer/ContextIdApplicationContextInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/initializer/ContextIdApplicationContextInitializerTests.java @@ -30,7 +30,7 @@ import static org.junit.Assert.assertEquals; */ public class ContextIdApplicationContextInitializerTests { - private ContextIdApplicationContextInitializer initializer = new ContextIdApplicationContextInitializer(); + private final ContextIdApplicationContextInitializer initializer = new ContextIdApplicationContextInitializer(); @Test public void testDefaults() { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/initializer/EnvironmentDelegateApplicationContextInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/initializer/EnvironmentDelegateApplicationContextInitializerTests.java index 6e180244f0..d25a763165 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/initializer/EnvironmentDelegateApplicationContextInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/initializer/EnvironmentDelegateApplicationContextInitializerTests.java @@ -41,7 +41,7 @@ public class EnvironmentDelegateApplicationContextInitializerTests { @Rule public ExpectedException thrown = ExpectedException.none(); - private EnvironmentDelegateApplicationContextInitializer initializer = new EnvironmentDelegateApplicationContextInitializer(); + private final EnvironmentDelegateApplicationContextInitializer initializer = new EnvironmentDelegateApplicationContextInitializer(); @Test public void orderedInitialize() throws Exception { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/listener/ConfigFileApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/listener/ConfigFileApplicationListenerTests.java index 759d0549a6..4c6361830b 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/listener/ConfigFileApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/listener/ConfigFileApplicationListenerTests.java @@ -57,12 +57,12 @@ import static org.junit.Assert.assertThat; */ public class ConfigFileApplicationListenerTests { - private StandardEnvironment environment = new StandardEnvironment(); + private final StandardEnvironment environment = new StandardEnvironment(); - private SpringApplicationEnvironmentAvailableEvent event = new SpringApplicationEnvironmentAvailableEvent( + private final SpringApplicationEnvironmentAvailableEvent event = new SpringApplicationEnvironmentAvailableEvent( new SpringApplication(), this.environment, new String[0]); - private ConfigFileApplicationListener initializer = new ConfigFileApplicationListener(); + private final ConfigFileApplicationListener initializer = new ConfigFileApplicationListener(); @Rule public ExpectedException expected = ExpectedException.none(); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/listener/EnvironmentDelegateApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/listener/EnvironmentDelegateApplicationListenerTests.java index b4175a6b03..89f84aa2cb 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/listener/EnvironmentDelegateApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/listener/EnvironmentDelegateApplicationListenerTests.java @@ -38,9 +38,9 @@ public class EnvironmentDelegateApplicationListenerTests { @Rule public ExpectedException thrown = ExpectedException.none(); - private EnvironmentDelegateApplicationListener listener = new EnvironmentDelegateApplicationListener(); + private final EnvironmentDelegateApplicationListener listener = new EnvironmentDelegateApplicationListener(); - private StaticApplicationContext context = new StaticApplicationContext(); + private final StaticApplicationContext context = new StaticApplicationContext(); @After public void close() { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/listener/FileEncodingApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/listener/FileEncodingApplicationListenerTests.java index 269c1a44f6..fb19d95c8d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/listener/FileEncodingApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/listener/FileEncodingApplicationListenerTests.java @@ -31,9 +31,9 @@ import org.springframework.core.env.StandardEnvironment; */ public class FileEncodingApplicationListenerTests { - private FileEncodingApplicationListener initializer = new FileEncodingApplicationListener(); - private ConfigurableEnvironment environment = new StandardEnvironment(); - private SpringApplicationEnvironmentAvailableEvent event = new SpringApplicationEnvironmentAvailableEvent( + private final FileEncodingApplicationListener initializer = new FileEncodingApplicationListener(); + private final ConfigurableEnvironment environment = new StandardEnvironment(); + private final SpringApplicationEnvironmentAvailableEvent event = new SpringApplicationEnvironmentAvailableEvent( new SpringApplication(), this.environment, new String[0]); @Test(expected = IllegalStateException.class) diff --git a/spring-boot/src/test/java/org/springframework/boot/context/listener/LoggingApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/listener/LoggingApplicationListenerTests.java index fd8001de44..8ceaccdf9a 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/listener/LoggingApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/listener/LoggingApplicationListenerTests.java @@ -57,13 +57,13 @@ public class LoggingApplicationListenerTests { @Rule public OutputCapture outputCapture = new OutputCapture(); - private LoggingApplicationListener initializer = new LoggingApplicationListener(); + private final LoggingApplicationListener initializer = new LoggingApplicationListener(); - private Log logger = new SLF4JLogFactory().getInstance(getClass()); + private final Log logger = new SLF4JLogFactory().getInstance(getClass()); - private SpringApplication springApplication = new SpringApplication(); + private final SpringApplication springApplication = new SpringApplication(); - private GenericApplicationContext context = new GenericApplicationContext(); + private final GenericApplicationContext context = new GenericApplicationContext(); @Before public void init() throws SecurityException, IOException { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/listener/VcapApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/listener/VcapApplicationListenerTests.java index c090a4d8a8..2e9498df3a 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/listener/VcapApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/listener/VcapApplicationListenerTests.java @@ -32,9 +32,9 @@ import static org.junit.Assert.assertEquals; */ public class VcapApplicationListenerTests { - private VcapApplicationListener initializer = new VcapApplicationListener(); - private ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(); - private SpringApplicationEnvironmentAvailableEvent event = new SpringApplicationEnvironmentAvailableEvent( + private final VcapApplicationListener initializer = new VcapApplicationListener(); + private final ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(); + private final SpringApplicationEnvironmentAvailableEvent event = new SpringApplicationEnvironmentAvailableEvent( new SpringApplication(), this.context.getEnvironment(), new String[0]); @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java index e4ada88e9e..fcac2d5644 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java @@ -49,7 +49,7 @@ import static org.junit.Assert.assertNotNull; */ public class EnableConfigurationPropertiesTests { - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Rule public ExpectedException expected = ExpectedException.none(); @@ -504,7 +504,7 @@ public class EnableConfigurationPropertiesTests { private String name; - private Nested nested = new Nested(); + private final Nested nested = new Nested(); public void setName(String name) { this.name = name; @@ -547,7 +547,7 @@ public class EnableConfigurationPropertiesTests { private int[] array; - private List list = new ArrayList(); + private final List list = new ArrayList(); // No getter - you should be able to bind to a write-only bean diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java index d8994ea88f..6865749bac 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java @@ -39,7 +39,7 @@ import static org.junit.Assert.assertTrue; */ public class JavaLoggerSystemTests { - private JavaLoggingSystem loggingSystem = new JavaLoggingSystem(getClass() + private final JavaLoggingSystem loggingSystem = new JavaLoggingSystem(getClass() .getClassLoader()); @Rule diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java index 80ad3809f0..f7261cf003 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java @@ -39,7 +39,7 @@ public class Log4JLoggingSystemTests { @Rule public OutputCapture output = new OutputCapture(); - private Log4JLoggingSystem loggingSystem = new Log4JLoggingSystem(getClass() + private final Log4JLoggingSystem loggingSystem = new Log4JLoggingSystem(getClass() .getClassLoader()); private Log4JLogger logger; diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/logback/ColorConverterTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/logback/ColorConverterTests.java index e00bde025c..a9aff2ce7f 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/logback/ColorConverterTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/logback/ColorConverterTests.java @@ -39,7 +39,7 @@ public class ColorConverterTests { private ColorConverter converter; private LoggingEvent event; - private String in = "in"; + private final String in = "in"; @BeforeClass public static void setupAnsi() { diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java index 216fd20f7f..8430c1001d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java @@ -40,7 +40,7 @@ public class LogbackLoggingSystemTests { @Rule public OutputCapture output = new OutputCapture(); - private LogbackLoggingSystem loggingSystem = new LogbackLoggingSystem(getClass() + private final LogbackLoggingSystem loggingSystem = new LogbackLoggingSystem(getClass() .getClassLoader()); private Log logger; diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/logback/WhitespaceThrowableProxyConverterTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/logback/WhitespaceThrowableProxyConverterTests.java index 04b146d44d..0d91293273 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/logback/WhitespaceThrowableProxyConverterTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/logback/WhitespaceThrowableProxyConverterTests.java @@ -36,9 +36,9 @@ public class WhitespaceThrowableProxyConverterTests { private static final String LINE_SEPARATOR = System.getProperty("line.separator"); - private WhitespaceThrowableProxyConverter converter = new WhitespaceThrowableProxyConverter(); + private final WhitespaceThrowableProxyConverter converter = new WhitespaceThrowableProxyConverter(); - private LoggingEvent event = new LoggingEvent(); + private final LoggingEvent event = new LoggingEvent(); @Test public void noStackTrace() throws Exception {