mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Polish static finals
Closes gh-12083
This commit is contained in:
parent
752a42710c
commit
fe023817c7
@ -46,7 +46,8 @@ class CloudFoundrySecurityInterceptor {
|
||||
|
||||
private final String applicationId;
|
||||
|
||||
private static Mono<SecurityResponse> SUCCESS = Mono.just(SecurityResponse.success());
|
||||
private static final Mono<SecurityResponse> SUCCESS = Mono
|
||||
.just(SecurityResponse.success());
|
||||
|
||||
CloudFoundrySecurityInterceptor(ReactiveTokenValidator tokenValidator,
|
||||
ReactiveCloudFoundrySecurityService cloudFoundrySecurityService,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -52,7 +52,7 @@ import org.springframework.util.StringUtils;
|
||||
public class JndiConnectionFactoryAutoConfiguration {
|
||||
|
||||
// Keep these in sync with the condition below
|
||||
private static String[] JNDI_LOCATIONS = { "java:/JmsXA",
|
||||
private static final String[] JNDI_LOCATIONS = { "java:/JmsXA",
|
||||
"java:/XAConnectionFactory" };
|
||||
|
||||
private final JmsProperties properties;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -59,7 +59,7 @@ public class HibernateJpaAutoConfiguration {
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE + 20)
|
||||
static class HibernateEntityManagerCondition extends SpringBootCondition {
|
||||
|
||||
private static String[] CLASS_NAMES = {
|
||||
private static final String[] CLASS_NAMES = {
|
||||
"org.hibernate.ejb.HibernateEntityManager",
|
||||
"org.hibernate.jpa.HibernateEntityManager" };
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -46,10 +46,10 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class WebConversionService extends DefaultFormattingConversionService {
|
||||
|
||||
private static final boolean jsr354Present = ClassUtils.isPresent(
|
||||
private static final boolean JSR_354_PRESENT = ClassUtils.isPresent(
|
||||
"javax.money.MonetaryAmount", WebConversionService.class.getClassLoader());
|
||||
|
||||
private static final boolean jodaTimePresent = ClassUtils.isPresent(
|
||||
private static final boolean JODA_TIME_PRESENT = ClassUtils.isPresent(
|
||||
"org.joda.time.LocalDate", WebConversionService.class.getClassLoader());
|
||||
|
||||
private final String dateFormat;
|
||||
@ -72,14 +72,14 @@ public class WebConversionService extends DefaultFormattingConversionService {
|
||||
|
||||
private void addFormatters() {
|
||||
addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory());
|
||||
if (jsr354Present) {
|
||||
if (JSR_354_PRESENT) {
|
||||
addFormatter(new CurrencyUnitFormatter());
|
||||
addFormatter(new MonetaryAmountFormatter());
|
||||
addFormatterForFieldAnnotation(
|
||||
new Jsr354NumberFormatAnnotationFormatterFactory());
|
||||
}
|
||||
registerJsr310();
|
||||
if (jodaTimePresent) {
|
||||
if (JODA_TIME_PRESENT) {
|
||||
registerJodaTime();
|
||||
}
|
||||
registerJavaDate();
|
||||
|
@ -48,7 +48,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class EncodePasswordCommand extends OptionParsingCommand {
|
||||
|
||||
private static Map<String, Supplier<PasswordEncoder>> ENCODERS;
|
||||
private static final Map<String, Supplier<PasswordEncoder>> ENCODERS;
|
||||
|
||||
static {
|
||||
Map<String, Supplier<PasswordEncoder>> encoders = new LinkedHashMap<>();
|
||||
|
@ -54,7 +54,7 @@ import org.springframework.core.Ordered;
|
||||
public abstract class GenericBomAstTransformation
|
||||
implements SpringBootAstTransformation, Ordered {
|
||||
|
||||
private static ClassNode BOM = ClassHelper.make(DependencyManagementBom.class);
|
||||
private static final ClassNode BOM = ClassHelper.make(DependencyManagementBom.class);
|
||||
|
||||
@Override
|
||||
public void visit(ASTNode[] nodes, SourceUnit source) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -105,9 +105,9 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi
|
||||
}
|
||||
|
||||
private void addFilters(ConfigurableMockMvcBuilder<?> builder) {
|
||||
ServletContextInitializerBeans Initializers = new ServletContextInitializerBeans(
|
||||
ServletContextInitializerBeans initializers = new ServletContextInitializerBeans(
|
||||
this.context);
|
||||
for (ServletContextInitializer initializer : Initializers) {
|
||||
for (ServletContextInitializer initializer : initializers) {
|
||||
if (initializer instanceof FilterRegistrationBean) {
|
||||
addFilter(builder, (FilterRegistrationBean<?>) initializer);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -34,12 +34,12 @@ import org.springframework.web.util.UriTemplateHandler;
|
||||
*/
|
||||
public class LocalHostUriTemplateHandler extends RootUriTemplateHandler {
|
||||
|
||||
private static final String PREFIX = "server.servlet.";
|
||||
|
||||
private final Environment environment;
|
||||
|
||||
private final String scheme;
|
||||
|
||||
private final String prefix = "server.servlet.";
|
||||
|
||||
/**
|
||||
* Create a new {@code LocalHostUriTemplateHandler} that will generate {@code http}
|
||||
* URIs using the given {@code environment} to determine the context path and port.
|
||||
@ -68,8 +68,7 @@ public class LocalHostUriTemplateHandler extends RootUriTemplateHandler {
|
||||
@Override
|
||||
public String getRootUri() {
|
||||
String port = this.environment.getProperty("local.server.port", "8080");
|
||||
String contextPath = this.environment.getProperty(this.prefix + "context-path",
|
||||
"");
|
||||
String contextPath = this.environment.getProperty(PREFIX + "context-path", "");
|
||||
return this.scheme + "://localhost:" + port + contextPath;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -33,7 +33,7 @@ class Tree extends ReflectionWrapper {
|
||||
private final Method acceptMethod = findMethod("accept", this.treeVisitorType,
|
||||
Object.class);
|
||||
|
||||
private final Method GET_CLASS_TREE_MEMBERS = findMethod(
|
||||
private final Method getClassTreeMembers = findMethod(
|
||||
findClass("com.sun.source.tree.ClassTree"), "getMembers");
|
||||
|
||||
Tree(Object instance) {
|
||||
@ -65,7 +65,7 @@ class Tree extends ReflectionWrapper {
|
||||
throws Throwable {
|
||||
if (method.getName().equals("visitClass")) {
|
||||
if ((Integer) args[1] == 0) {
|
||||
Iterable members = (Iterable) Tree.this.GET_CLASS_TREE_MEMBERS
|
||||
Iterable members = (Iterable) Tree.this.getClassTreeMembers
|
||||
.invoke(args[0]);
|
||||
for (Object member : members) {
|
||||
if (member != null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -30,7 +30,7 @@ import org.springframework.boot.loader.data.RandomAccessData;
|
||||
*/
|
||||
class CentralDirectoryParser {
|
||||
|
||||
private int CENTRAL_DIRECTORY_HEADER_BASE_SIZE = 46;
|
||||
private static final int CENTRAL_DIRECTORY_HEADER_BASE_SIZE = 46;
|
||||
|
||||
private final List<CentralDirectoryVisitor> visitors = new ArrayList<>();
|
||||
|
||||
@ -67,7 +67,7 @@ class CentralDirectoryParser {
|
||||
for (int i = 0; i < endRecord.getNumberOfRecords(); i++) {
|
||||
fileHeader.load(bytes, dataOffset, null, 0, null);
|
||||
visitFileHeader(dataOffset, fileHeader);
|
||||
dataOffset += this.CENTRAL_DIRECTORY_HEADER_BASE_SIZE
|
||||
dataOffset += CENTRAL_DIRECTORY_HEADER_BASE_SIZE
|
||||
+ fileHeader.getName().length() + fileHeader.getComment().length()
|
||||
+ fileHeader.getExtra().length;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -32,7 +32,7 @@ import java.util.Set;
|
||||
*/
|
||||
class SpringBootExceptionHandler implements UncaughtExceptionHandler {
|
||||
|
||||
private static Set<String> LOG_CONFIGURATION_MESSAGES;
|
||||
private static final Set<String> LOG_CONFIGURATION_MESSAGES;
|
||||
|
||||
static {
|
||||
Set<String> messages = new HashSet<>();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -62,7 +62,7 @@ public class ParentContextApplicationContextInitializer implements
|
||||
private static class EventPublisher
|
||||
implements ApplicationListener<ContextRefreshedEvent>, Ordered {
|
||||
|
||||
private static EventPublisher INSTANCE = new EventPublisher();
|
||||
private static final EventPublisher INSTANCE = new EventPublisher();
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
|
@ -110,7 +110,7 @@ public class LoggingApplicationListener implements GenericApplicationListener {
|
||||
*/
|
||||
public static final String LOGGING_SYSTEM_BEAN_NAME = "springBootLoggingSystem";
|
||||
|
||||
private static MultiValueMap<LogLevel, String> LOG_LEVEL_LOGGERS;
|
||||
private static final MultiValueMap<LogLevel, String> LOG_LEVEL_LOGGERS;
|
||||
|
||||
private static AtomicBoolean shutdownHookRegistered = new AtomicBoolean(false);
|
||||
|
||||
@ -125,11 +125,11 @@ public class LoggingApplicationListener implements GenericApplicationListener {
|
||||
LOG_LEVEL_LOGGERS.add(LogLevel.DEBUG, "org.hibernate.SQL");
|
||||
}
|
||||
|
||||
private static Class<?>[] EVENT_TYPES = { ApplicationStartingEvent.class,
|
||||
private static final Class<?>[] EVENT_TYPES = { ApplicationStartingEvent.class,
|
||||
ApplicationEnvironmentPreparedEvent.class, ApplicationPreparedEvent.class,
|
||||
ContextClosedEvent.class, ApplicationFailedEvent.class };
|
||||
|
||||
private static Class<?>[] SOURCE_TYPES = { SpringApplication.class,
|
||||
private static final Class<?>[] SOURCE_TYPES = { SpringApplication.class,
|
||||
ApplicationContext.class };
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
Loading…
Reference in New Issue
Block a user