Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye authored and wilkinsona committed Oct 2, 2017
1 parent bcbf7b5 commit bfa291f
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 98 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Running a full build is a two phase process.
Preparing the build will compile and install the `spring-boot-maven-plugin` so that it
can be referenced during the full build. It also generates a `settings.xml` file that
enables a `snapshot`, `milestone` or `release` profiles based on the version being
build. To prepare the build, from the root directory use:
built. To prepare the build, from the root directory use:

[indent=0]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class SessionProperties {
*/
private StoreType storeType;

private Integer timeout;
private final Integer timeout;

private final Hazelcast hazelcast = new Hazelcast();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2017 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.
Expand Down Expand Up @@ -39,14 +39,14 @@
*/
public class DefaultCommandFactory implements CommandFactory {

private static final List<Command> DEFAULT_COMMANDS = Arrays.<Command>asList(
private static final List<Command> defaultCommands = Arrays.<Command>asList(
new VersionCommand(), new RunCommand(), new TestCommand(), new GrabCommand(),
new JarCommand(), new WarCommand(), new InstallCommand(),
new UninstallCommand(), new InitCommand());

@Override
public Collection<Command> getCommands() {
return DEFAULT_COMMANDS;
return defaultCommands;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
Expand Down Expand Up @@ -42,30 +42,31 @@
@Order(Ordered.LOWEST_PRECEDENCE)
public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostProcessor {

private static final Map<String, Object> PROPERTIES;
private static final Map<String, Object> properties;

static {
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("spring.thymeleaf.cache", "false");
properties.put("spring.freemarker.cache", "false");
properties.put("spring.groovy.template.cache", "false");
properties.put("spring.mustache.cache", "false");
properties.put("server.session.persistent", "true");
properties.put("spring.h2.console.enabled", "true");
properties.put("spring.resources.cache-period", "0");
properties.put("spring.resources.chain.cache", "false");
properties.put("spring.template.provider.cache", "false");
properties.put("spring.mvc.log-resolved-exception", "true");
properties.put("server.jsp-servlet.init-parameters.development", "true");
PROPERTIES = Collections.unmodifiableMap(properties);
Map<String, Object> devToolsProperties = new HashMap<String, Object>();
devToolsProperties.put("spring.thymeleaf.cache", "false");
devToolsProperties.put("spring.freemarker.cache", "false");
devToolsProperties.put("spring.groovy.template.cache", "false");
devToolsProperties.put("spring.mustache.cache", "false");
devToolsProperties.put("server.session.persistent", "true");
devToolsProperties.put("spring.h2.console.enabled", "true");
devToolsProperties.put("spring.resources.cache-period", "0");
devToolsProperties.put("spring.resources.chain.cache", "false");
devToolsProperties.put("spring.template.provider.cache", "false");
devToolsProperties.put("spring.mvc.log-resolved-exception", "true");
devToolsProperties.put("server.servlet.jsp.init-parameters.development", "true");
devToolsProperties.put("spring.reactor.stacktrace-mode.enabled", "true");
properties = Collections.unmodifiableMap(devToolsProperties);
}

@Override
public void postProcessEnvironment(ConfigurableEnvironment environment,
SpringApplication application) {
if (isLocalApplication(environment) && canAddProperties(environment)) {
PropertySource<?> propertySource = new MapPropertySource("refresh",
PROPERTIES);
properties);
environment.getPropertySources().addLast(propertySource);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ content into your application; rather pick only the properties that you need.
endpoints.flyway.sensitive= # Mark if the endpoint exposes sensitive information.
endpoints.health.enabled= # Enable the endpoint.
endpoints.health.id= # Endpoint identifier.
endpoints.health.mapping.*= # Mapping of health statuses to HttpStatus codes. By default, registered health statuses map to sensible defaults (i.e. UP maps to 200).
endpoints.health.mapping.*= # Mapping of health statuses to HTTP status codes. By default, registered health statuses map to sensible defaults (i.e. UP maps to 200).
endpoints.health.path= # Endpoint path.
endpoints.health.sensitive= # Mark if the endpoint exposes sensitive information.
endpoints.health.time-to-live=1000 # Time to live for cached result, in milliseconds.
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-docs/src/main/asciidoc/howto.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,7 @@ respectively.
Spring Data REST can expose the `Repository` implementations as REST endpoints for you as
long as Spring MVC has been enabled for the application.

Spring Boot exposes as set of useful properties from the `spring.data.rest` namespace that
Spring Boot exposes a set of useful properties from the `spring.data.rest` namespace that
customize the
{spring-data-rest-javadoc}/core/config/RepositoryRestConfiguration.{dc-ext}[`RepositoryRestConfiguration`].
If you need to provide additional customization, you should use a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ to your application properties:
The HTTP status code in the response reflects the overall health status (e.g. `UP`
maps to 200, `OUT_OF_SERVICE` or `DOWN` to 503). You might also want to register custom
status mappings with the `HealthMvcEndpoint` if you access the health endpoint over HTTP.
For example, the following maps `FATAL` to `HttpStatus.SERVICE_UNAVAILABLE`:
For example, the following maps `FATAL` to 503 (service unavailable):

[source,properties,indent=0]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ can be achieved as follows:
You can also customize the static resource locations using
`spring.resources.static-locations` (replacing the default values with a list of directory
locations). If you do this the default welcome page detection will switch to your custom
locations, so if there is an `index.html` in any of your locations on startup, it will be
locations. So if there is an `index.html` in any of your locations on startup, it will be
the home page of the application.

In addition to the '`standard`' static resource locations above, a special case is made
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ static class ContextCustomizerKey {

private static final Class<?>[] NO_IMPORTS = {};

private static final Set<AnnotationFilter> ANNOTATION_FILTERS;
private static final Set<AnnotationFilter> annotationFilters;

static {
Set<AnnotationFilter> filters = new HashSet<AnnotationFilter>();
filters.add(new JavaLangAnnotationFilter());
filters.add(new KotlinAnnotationFilter());
filters.add(new SpockAnnotationFilter());
ANNOTATION_FILTERS = Collections.unmodifiableSet(filters);
annotationFilters = Collections.unmodifiableSet(filters);
}

private final Set<Object> key;
Expand Down Expand Up @@ -274,7 +274,7 @@ private void collectElementAnnotations(AnnotatedElement element,
}

private boolean isIgnoredAnnotation(Annotation annotation) {
for (AnnotationFilter annotationFilter : ANNOTATION_FILTERS) {
for (AnnotationFilter annotationFilter : annotationFilters) {
if (annotationFilter.isIgnored(annotation)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static class FieldCollector implements TreeVisitor {
WRAPPER_TYPES = Collections.unmodifiableMap(types);
}

private static final Map<Class<?>, Object> DEFAULT_TYPE_VALUES;
private static final Map<Class<?>, Object> defaultTypeValues;

static {
Map<Class<?>, Object> values = new HashMap<Class<?>, Object>();
Expand All @@ -85,16 +85,16 @@ private static class FieldCollector implements TreeVisitor {
values.put(Short.class, (short) 0);
values.put(Integer.class, 0);
values.put(Long.class, (long) 0);
DEFAULT_TYPE_VALUES = Collections.unmodifiableMap(values);
defaultTypeValues = Collections.unmodifiableMap(values);
}

private static final Map<String, Object> WELL_KNOWN_STATIC_FINALS;
private static final Map<String, Object> wellKnownStaticFinals;

static {
Map<String, Object> values = new HashMap<String, Object>();
values.put("Boolean.TRUE", true);
values.put("Boolean.FALSE", false);
WELL_KNOWN_STATIC_FINALS = Collections.unmodifiableMap(values);
wellKnownStaticFinals = Collections.unmodifiableMap(values);
}

private final Map<String, Object> fieldValues = new HashMap<String, Object>();
Expand All @@ -115,7 +115,7 @@ public void visitVariable(VariableTree variable) throws Exception {
private Object getValue(VariableTree variable) throws Exception {
ExpressionTree initializer = variable.getInitializer();
Class<?> wrapperType = WRAPPER_TYPES.get(variable.getType());
Object defaultValue = DEFAULT_TYPE_VALUES.get(wrapperType);
Object defaultValue = defaultTypeValues.get(wrapperType);
if (initializer != null) {
return getValue(initializer, defaultValue);
}
Expand Down Expand Up @@ -148,7 +148,7 @@ private Object getValue(ExpressionTree expression, Object defaultValue)
return this.staticFinals.get(expression.toString());
}
if (expression.getKind().equals("MEMBER_SELECT")) {
return WELL_KNOWN_STATIC_FINALS.get(expression.toString());
return wellKnownStaticFinals.get(expression.toString());
}
return defaultValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ public boolean isExecutable() {
*/
public static class War implements Layout {

private static final Map<LibraryScope, String> SCOPE_DESTINATIONS;
private static final Map<LibraryScope, String> scopeDestinations;

static {
Map<LibraryScope, String> map = new HashMap<LibraryScope, String>();
map.put(LibraryScope.COMPILE, "WEB-INF/lib/");
map.put(LibraryScope.CUSTOM, "WEB-INF/lib/");
map.put(LibraryScope.RUNTIME, "WEB-INF/lib/");
map.put(LibraryScope.PROVIDED, "WEB-INF/lib-provided/");
SCOPE_DESTINATIONS = Collections.unmodifiableMap(map);
scopeDestinations = Collections.unmodifiableMap(map);
}

@Override
Expand All @@ -141,7 +141,7 @@ public String getLauncherClassName() {

@Override
public String getLibraryDestination(String libraryName, LibraryScope scope) {
return SCOPE_DESTINATIONS.get(scope);
return scopeDestinations.get(scope);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
Expand Down Expand Up @@ -42,15 +42,15 @@
*/
public class ArtifactsLibraries implements Libraries {

private static final Map<String, LibraryScope> SCOPES;
private static final Map<String, LibraryScope> scopes;

static {
Map<String, LibraryScope> scopes = new HashMap<String, LibraryScope>();
scopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE);
scopes.put(Artifact.SCOPE_RUNTIME, LibraryScope.RUNTIME);
scopes.put(Artifact.SCOPE_PROVIDED, LibraryScope.PROVIDED);
scopes.put(Artifact.SCOPE_SYSTEM, LibraryScope.PROVIDED);
SCOPES = Collections.unmodifiableMap(scopes);
Map<String, LibraryScope> libraryScopes = new HashMap<String, LibraryScope>();
libraryScopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE);
libraryScopes.put(Artifact.SCOPE_RUNTIME, LibraryScope.RUNTIME);
libraryScopes.put(Artifact.SCOPE_PROVIDED, LibraryScope.PROVIDED);
libraryScopes.put(Artifact.SCOPE_SYSTEM, LibraryScope.PROVIDED);
scopes = Collections.unmodifiableMap(libraryScopes);
}

private final Set<Artifact> artifacts;
Expand All @@ -70,7 +70,7 @@ public ArtifactsLibraries(Set<Artifact> artifacts, Collection<Dependency> unpack
public void doWithLibraries(LibraryCallback callback) throws IOException {
Set<String> duplicates = getDuplicates(this.artifacts);
for (Artifact artifact : this.artifacts) {
LibraryScope scope = SCOPES.get(artifact.getScope());
LibraryScope scope = scopes.get(artifact.getScope());
if (scope != null && artifact.getFile() != null) {
String name = getFileName(artifact);
if (duplicates.contains(name)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
Expand Down Expand Up @@ -49,28 +49,28 @@
@ConverterKeys({ "clr", "color" })
public final class ColorConverter extends LogEventPatternConverter {

private static final Map<String, AnsiElement> ELEMENTS;
private static final Map<String, AnsiElement> elements;

static {
Map<String, AnsiElement> elements = new HashMap<String, AnsiElement>();
elements.put("faint", AnsiStyle.FAINT);
elements.put("red", AnsiColor.RED);
elements.put("green", AnsiColor.GREEN);
elements.put("yellow", AnsiColor.YELLOW);
elements.put("blue", AnsiColor.BLUE);
elements.put("magenta", AnsiColor.MAGENTA);
elements.put("cyan", AnsiColor.CYAN);
ELEMENTS = Collections.unmodifiableMap(elements);
Map<String, AnsiElement> ansiElements = new HashMap<String, AnsiElement>();
ansiElements.put("faint", AnsiStyle.FAINT);
ansiElements.put("red", AnsiColor.RED);
ansiElements.put("green", AnsiColor.GREEN);
ansiElements.put("yellow", AnsiColor.YELLOW);
ansiElements.put("blue", AnsiColor.BLUE);
ansiElements.put("magenta", AnsiColor.MAGENTA);
ansiElements.put("cyan", AnsiColor.CYAN);
elements = Collections.unmodifiableMap(ansiElements);
}

private static final Map<Integer, AnsiElement> LEVELS;
private static final Map<Integer, AnsiElement> levels;

static {
Map<Integer, AnsiElement> levels = new HashMap<Integer, AnsiElement>();
levels.put(Level.FATAL.intLevel(), AnsiColor.RED);
levels.put(Level.ERROR.intLevel(), AnsiColor.RED);
levels.put(Level.WARN.intLevel(), AnsiColor.YELLOW);
LEVELS = Collections.unmodifiableMap(levels);
Map<Integer, AnsiElement> ansiLevels = new HashMap<Integer, AnsiElement>();
ansiLevels.put(Level.FATAL.intLevel(), AnsiColor.RED);
ansiLevels.put(Level.ERROR.intLevel(), AnsiColor.RED);
ansiLevels.put(Level.WARN.intLevel(), AnsiColor.YELLOW);
levels = Collections.unmodifiableMap(ansiLevels);
}

private final List<PatternFormatter> formatters;
Expand Down Expand Up @@ -101,7 +101,7 @@ public static ColorConverter newInstance(Configuration config, String[] options)
}
PatternParser parser = PatternLayout.createPatternParser(config);
List<PatternFormatter> formatters = parser.parse(options[0]);
AnsiElement element = (options.length == 1 ? null : ELEMENTS.get(options[1]));
AnsiElement element = (options.length == 1 ? null : elements.get(options[1]));
return new ColorConverter(formatters, element);
}

Expand All @@ -125,7 +125,7 @@ public void format(LogEvent event, StringBuilder toAppendTo) {
AnsiElement element = this.styling;
if (element == null) {
// Assume highlighting
element = LEVELS.get(event.getLevel().intLevel());
element = levels.get(event.getLevel().intLevel());
element = (element == null ? AnsiColor.GREEN : element);
}
appendAnsiString(toAppendTo, buf.toString(), element);
Expand Down
Loading

0 comments on commit bfa291f

Please sign in to comment.