diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java index df1c7a86ba6..34f9d619df8 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java @@ -135,8 +135,8 @@ public class AuditEvent implements Serializable { @Override public String toString() { - return "AuditEvent [timestamp=" + this.timestamp + ", principal=" - + this.principal + ", type=" + this.type + ", data=" + this.data + "]"; + return "AuditEvent [timestamp=" + this.timestamp + ", principal=" + this.principal + + ", type=" + this.type + ", data=" + this.data + "]"; } } 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 9bc097c3610..a08138cea78 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 @@ -40,7 +40,8 @@ public class AuditApplicationEvent extends ApplicationEvent { * @param data the event data * @see AuditEvent#AuditEvent(String, String, Map) */ - public AuditApplicationEvent(String principal, String type, Map data) { + public AuditApplicationEvent(String principal, String type, + Map data) { this(new AuditEvent(principal, type, data)); } 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 3b3f1235bf1..1a8955ef686 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 @@ -266,8 +266,8 @@ public class EndpointAutoConfiguration { private String time; public String getId() { - return this.id == null ? "" : (this.id.length() > 7 ? this.id.substring( - 0, 7) : this.id); + return this.id == null ? "" + : (this.id.length() > 7 ? this.id.substring(0, 7) : this.id); } public void setId(String id) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java index 34017c4fa14..bb8a748fe4e 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java @@ -53,7 +53,8 @@ public class ManagementServerProperties implements SecurityPrerequisite { * management endpoints. This is a useful place to put user-defined access rules if * you want to override the default access rules. */ - public static final int ACCESS_OVERRIDE_ORDER = ManagementServerProperties.BASIC_AUTH_ORDER - 1; + public static final int ACCESS_OVERRIDE_ORDER = ManagementServerProperties.BASIC_AUTH_ORDER + - 1; /** * Management endpoint HTTP port. Use the same port as the application by default. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java index f22320c65db..fa1d06c0202 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java @@ -91,8 +91,8 @@ final class MetricsFilter extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, - HttpServletResponse response, FilterChain chain) throws ServletException, - IOException { + HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { StopWatch stopWatch = createStopWatchIfNecessary(request); String path = new UrlPathHelper().getPathWithinApplication(request); int status = HttpStatus.INTERNAL_SERVER_ERROR.value(); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java index 3319da4803f..ec3c1ab32b1 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java @@ -50,7 +50,8 @@ public class ShellProperties { private boolean defaultAuth = true; @Autowired(required = false) - private CrshShellProperties[] additionalProperties = new CrshShellProperties[] { new SimpleAuthenticationProperties() }; + private CrshShellProperties[] additionalProperties = new CrshShellProperties[] { + new SimpleAuthenticationProperties() }; /** * Scan for changes and update the command if necessary (in seconds). @@ -215,8 +216,8 @@ public class ShellProperties { /** * Base class for Auth specific properties. */ - public static abstract class CrshShellAuthenticationProperties extends - CrshShellProperties { + public static abstract class CrshShellAuthenticationProperties + extends CrshShellProperties { } @@ -325,8 +326,8 @@ public class ShellProperties { * Auth specific properties for JAAS authentication. */ @ConfigurationProperties(prefix = "shell.auth.jaas", ignoreUnknownFields = false) - public static class JaasAuthenticationProperties extends - CrshShellAuthenticationProperties { + public static class JaasAuthenticationProperties + extends CrshShellAuthenticationProperties { /** * JAAS domain. @@ -354,8 +355,8 @@ public class ShellProperties { * Auth specific properties for key authentication. */ @ConfigurationProperties(prefix = "shell.auth.key", ignoreUnknownFields = false) - public static class KeyAuthenticationProperties extends - CrshShellAuthenticationProperties { + public static class KeyAuthenticationProperties + extends CrshShellAuthenticationProperties { /** * Path to the authentication key. This should point to a valid ".pem" file. @@ -385,8 +386,8 @@ public class ShellProperties { * Auth specific properties for simple authentication. */ @ConfigurationProperties(prefix = "shell.auth.simple", ignoreUnknownFields = false) - public static class SimpleAuthenticationProperties extends - CrshShellAuthenticationProperties { + public static class SimpleAuthenticationProperties + extends CrshShellAuthenticationProperties { private static Log logger = LogFactory .getLog(SimpleAuthenticationProperties.class); @@ -460,8 +461,8 @@ public class ShellProperties { * Auth specific properties for Spring authentication. */ @ConfigurationProperties(prefix = "shell.auth.spring", ignoreUnknownFields = false) - public static class SpringAuthenticationProperties extends - CrshShellAuthenticationProperties { + public static class SpringAuthenticationProperties + extends CrshShellAuthenticationProperties { /** * Comma-separated list of required roles to login to the CRaSH console. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java index a7e4436b3a6..eb3d880a339 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java @@ -109,8 +109,8 @@ public abstract class AbstractEndpoint implements Endpoint, EnvironmentAwa return this.enabled; } if (this.environment != null) { - return this.environment.getProperty(ENDPOINTS_ENABLED_PROPERTY, - Boolean.class, true); + return this.environment.getProperty(ENDPOINTS_ENABLED_PROPERTY, Boolean.class, + true); } return true; } 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 b129b1b2e29..03c0615035b 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 @@ -36,8 +36,8 @@ import org.springframework.core.env.Environment; * @author Dave Syer */ @ConfigurationProperties(prefix = "endpoints.beans", ignoreUnknownFields = false) -public class BeansEndpoint extends AbstractEndpoint> implements - ApplicationContextAware { +public class BeansEndpoint extends AbstractEndpoint> + implements ApplicationContextAware { private final LiveBeansView liveBeansView = new LiveBeansView(); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java index 995af74eaaa..a038ed3b059 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java @@ -84,7 +84,8 @@ public class DataSourcePublicMetrics implements PublicMetrics { return metrics; } - private void addMetric(Set> metrics, String name, T value) { + private void addMetric(Set> metrics, String name, + T value) { if (value != null) { metrics.add(new Metric(name, value)); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DumpEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DumpEndpoint.java index 497f4823e80..ce34dae2f3e 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DumpEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DumpEndpoint.java @@ -40,8 +40,8 @@ public class DumpEndpoint extends AbstractEndpoint> { @Override public List invoke() { - return Arrays.asList(ManagementFactory.getThreadMXBean().dumpAllThreads(true, - true)); + return Arrays + .asList(ManagementFactory.getThreadMXBean().dumpAllThreads(true, true)); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java index 9d4f4a16e1f..a4d65af6b75 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java @@ -86,11 +86,12 @@ public class RequestMappingEndpoint extends AbstractEndpoint protected void extractMethodMappings(ApplicationContext applicationContext, Map result) { if (applicationContext != null) { - for (String name : applicationContext.getBeansOfType( - AbstractHandlerMethodMapping.class).keySet()) { + for (String name : applicationContext + .getBeansOfType(AbstractHandlerMethodMapping.class).keySet()) { @SuppressWarnings("unchecked") - Map methods = applicationContext.getBean(name, - AbstractHandlerMethodMapping.class).getHandlerMethods(); + Map methods = applicationContext + .getBean(name, AbstractHandlerMethodMapping.class) + .getHandlerMethods(); for (Object key : methods.keySet()) { Map map = new LinkedHashMap(); map.put("bean", name); @@ -144,10 +145,8 @@ public class RequestMappingEndpoint extends AbstractEndpoint for (AbstractHandlerMethodMapping mapping : methodMappings) { Map methods = mapping.getHandlerMethods(); for (Map.Entry entry : methods.entrySet()) { - result.put( - String.valueOf(entry.getKey()), - Collections.singletonMap("method", - String.valueOf(entry.getValue()))); + result.put(String.valueOf(entry.getKey()), Collections + .singletonMap("method", String.valueOf(entry.getValue()))); } } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java index ad05ffeabb4..922b79dc8b3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java @@ -51,11 +51,13 @@ public class RichGaugeReaderPublicMetrics implements PublicMetrics { private List> convert(RichGauge gauge) { List> result = new ArrayList>(6); - result.add(new Metric(gauge.getName() + RichGauge.AVG, gauge.getAverage())); + result.add( + new Metric(gauge.getName() + RichGauge.AVG, gauge.getAverage())); result.add(new Metric(gauge.getName() + RichGauge.VAL, gauge.getValue())); result.add(new Metric(gauge.getName() + RichGauge.MIN, gauge.getMin())); result.add(new Metric(gauge.getName() + RichGauge.MAX, gauge.getMax())); - result.add(new Metric(gauge.getName() + RichGauge.ALPHA, gauge.getAlpha())); + result.add( + new Metric(gauge.getName() + RichGauge.ALPHA, gauge.getAlpha())); result.add(new Metric(gauge.getName() + RichGauge.COUNT, gauge.getCount())); return result; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java index 5ad68a7f726..6de9ca8d640 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java @@ -32,8 +32,8 @@ import org.springframework.context.ConfigurableApplicationContext; * @author Christian Dupuis */ @ConfigurationProperties(prefix = "endpoints.shutdown", ignoreUnknownFields = false) -public class ShutdownEndpoint extends AbstractEndpoint> implements - ApplicationContextAware { +public class ShutdownEndpoint extends AbstractEndpoint> + implements ApplicationContextAware { private ConfigurableApplicationContext context; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java index 4e10836bf6f..7e5f90f0c89 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java @@ -66,11 +66,12 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { protected void addBasicMetrics(Collection> result) { // NOTE: ManagementFactory must not be used here since it fails on GAE result.add(new Metric("mem", Runtime.getRuntime().totalMemory() / 1024)); - result.add(new Metric("mem.free", Runtime.getRuntime().freeMemory() / 1024)); - result.add(new Metric("processors", Runtime.getRuntime() - .availableProcessors())); - result.add(new Metric("instance.uptime", System.currentTimeMillis() - - this.timestamp)); + result.add( + new Metric("mem.free", Runtime.getRuntime().freeMemory() / 1024)); + result.add(new Metric("processors", + Runtime.getRuntime().availableProcessors())); + result.add(new Metric("instance.uptime", + System.currentTimeMillis() - this.timestamp)); } /** @@ -81,10 +82,10 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { private void addManagementMetrics(Collection> result) { try { // Add JVM up time in ms - result.add(new Metric("uptime", ManagementFactory.getRuntimeMXBean() - .getUptime())); - result.add(new Metric("systemload.average", ManagementFactory - .getOperatingSystemMXBean().getSystemLoadAverage())); + result.add(new Metric("uptime", + ManagementFactory.getRuntimeMXBean().getUptime())); + result.add(new Metric("systemload.average", + ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage())); addHeapMetrics(result); addThreadMetrics(result); addClassLoadingMetrics(result); @@ -114,10 +115,10 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { */ protected void addThreadMetrics(Collection> result) { ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean(); - result.add(new Metric("threads.peak", (long) threadMxBean - .getPeakThreadCount())); - result.add(new Metric("threads.daemon", (long) threadMxBean - .getDaemonThreadCount())); + result.add(new Metric("threads.peak", + (long) threadMxBean.getPeakThreadCount())); + result.add(new Metric("threads.daemon", + (long) threadMxBean.getDaemonThreadCount())); result.add(new Metric("threads", (long) threadMxBean.getThreadCount())); } @@ -127,12 +128,12 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { */ protected void addClassLoadingMetrics(Collection> result) { ClassLoadingMXBean classLoadingMxBean = ManagementFactory.getClassLoadingMXBean(); - result.add(new Metric("classes", (long) classLoadingMxBean - .getLoadedClassCount())); - result.add(new Metric("classes.loaded", classLoadingMxBean - .getTotalLoadedClassCount())); - result.add(new Metric("classes.unloaded", classLoadingMxBean - .getUnloadedClassCount())); + result.add(new Metric("classes", + (long) classLoadingMxBean.getLoadedClassCount())); + result.add(new Metric("classes.loaded", + classLoadingMxBean.getTotalLoadedClassCount())); + result.add(new Metric("classes.unloaded", + classLoadingMxBean.getUnloadedClassCount())); } /** @@ -144,10 +145,10 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { .getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMxBeans) { String name = beautifyGcName(garbageCollectorMXBean.getName()); - result.add(new Metric("gc." + name + ".count", garbageCollectorMXBean - .getCollectionCount())); - result.add(new Metric("gc." + name + ".time", garbageCollectorMXBean - .getCollectionTime())); + result.add(new Metric("gc." + name + ".count", + garbageCollectorMXBean.getCollectionCount())); + result.add(new Metric("gc." + name + ".time", + garbageCollectorMXBean.getCollectionTime())); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java index 97e8ba596df..71ea6487e38 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java @@ -47,7 +47,8 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa @Override public Collection> metrics() { if (this.applicationContext instanceof EmbeddedWebApplicationContext) { - Manager manager = getManager((EmbeddedWebApplicationContext) this.applicationContext); + Manager manager = getManager( + (EmbeddedWebApplicationContext) this.applicationContext); if (manager != null) { return metrics(manager); } @@ -65,7 +66,8 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa } private Manager getManager(TomcatEmbeddedServletContainer servletContainer) { - for (Container container : servletContainer.getTomcat().getHost().findChildren()) { + for (Container container : servletContainer.getTomcat().getHost() + .findChildren()) { if (container instanceof Context) { return ((Context) container).getManager(); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java index 8dffeda02f1..49dbfa2da28 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java @@ -37,8 +37,8 @@ import org.springframework.web.bind.annotation.ResponseStatus; * @author Christian Dupuis * @author Andy Wilkinson */ -public class EnvironmentMvcEndpoint extends EndpointMvcAdapter implements - EnvironmentAware { +public class EnvironmentMvcEndpoint extends EndpointMvcAdapter + implements EnvironmentAware { private Environment environment; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java index 4e4eefcddc2..c38098f5599 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java @@ -42,8 +42,9 @@ public class ShutdownMvcEndpoint extends EndpointMvcAdapter { @Override public Object invoke() { if (!getDelegate().isEnabled()) { - return new ResponseEntity>(Collections.singletonMap( - "message", "This endpoint is disabled"), HttpStatus.NOT_FOUND); + return new ResponseEntity>( + Collections.singletonMap("message", "This endpoint is disabled"), + HttpStatus.NOT_FOUND); } return super.invoke(); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java index b900dcc3cab..a4430bc47d3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java @@ -53,9 +53,10 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator { builder.up(); } else { - logger.warn(String.format("Free disk space below threshold. " - + "Available: %d bytes (threshold: %d bytes)", diskFreeInBytes, - this.properties.getThreshold())); + logger.warn(String.format( + "Free disk space below threshold. " + + "Available: %d bytes (threshold: %d bytes)", + diskFreeInBytes, this.properties.getThreshold())); builder.down(); } builder.withDetail("total", path.getTotalSpace()) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java index c16b62706d9..f8d71c61fb7 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java @@ -91,8 +91,8 @@ public class Metric { * @return a new {@link Metric} instance */ public Metric increment(int amount) { - return new Metric(this.getName(), new Long(this.getValue().longValue() - + amount)); + return new Metric(this.getName(), + new Long(this.getValue().longValue() + amount)); } /** diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java index 2557f0056db..c08a5481727 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java @@ -46,7 +46,8 @@ public class PrefixMetricGroupExporter extends AbstractMetricExporter { * @param reader a reader as the source of metrics * @param writer the writer to send the metrics to */ - public PrefixMetricGroupExporter(PrefixMetricReader reader, PrefixMetricWriter writer) { + public PrefixMetricGroupExporter(PrefixMetricReader reader, + PrefixMetricWriter writer) { this(reader, writer, ""); } @@ -57,8 +58,8 @@ public class PrefixMetricGroupExporter extends AbstractMetricExporter { * @param writer the writer to send the metrics to * @param prefix the prefix for metrics to export */ - public PrefixMetricGroupExporter(PrefixMetricReader reader, - PrefixMetricWriter writer, String prefix) { + public PrefixMetricGroupExporter(PrefixMetricReader reader, PrefixMetricWriter writer, + String prefix) { super(prefix); this.reader = reader; this.writer = writer; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java index 6261ed0ead0..a9dad4b3664 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java @@ -240,8 +240,8 @@ public class MetricRegistryMetricReader implements MetricReader, MetricRegistryL result = new HashSet(); } if (result.isEmpty()) { - for (PropertyDescriptor descriptor : BeanUtils.getPropertyDescriptors(metric - .getClass())) { + for (PropertyDescriptor descriptor : BeanUtils + .getPropertyDescriptors(metric.getClass())) { if (ClassUtils.isAssignable(Number.class, descriptor.getPropertyType())) { result.add(descriptor.getName()); } 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 e911cb98ae7..096f22edb46 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 @@ -150,8 +150,8 @@ public class RedisMetricRepository implements MetricRepository { String name = delta.getName(); String key = keyFor(name); trackMembership(key); - double value = this.zSetOperations.incrementScore(key, delta.getValue() - .doubleValue()); + double value = this.zSetOperations.incrementScore(key, + delta.getValue().doubleValue()); String raw = serialize(new Metric(name, value, delta.getTimestamp())); this.redisOperations.opsForValue().set(key, raw); } 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 de31895f38e..c12e5ca0423 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 @@ -108,8 +108,8 @@ public class RedisMultiMetricRepository implements MultiMetricRepository { .boundZSetOps(groupKey); String key = keyFor(delta.getName()); double value = zSetOperations.incrementScore(key, delta.getValue().doubleValue()); - String raw = serialize(new Metric(delta.getName(), value, - delta.getTimestamp())); + String raw = serialize( + new Metric(delta.getName(), value, delta.getTimestamp())); this.redisOperations.opsForValue().set(key, raw); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGauge.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGauge.java index 1dfb4051dff..564f44dea76 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGauge.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGauge.java @@ -23,8 +23,8 @@ import org.springframework.util.Assert; *

* The value of the average will depend on whether a weight ('alpha') is set for the * gauge. If it is unset, the average will contain a simple arithmetic mean. If a weight - * is set, an exponential moving average will be calculated as defined in this NIST + * is set, an exponential moving average will be calculated as defined in this + * NIST * document. * * @author Luke Taylor 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 a2901512662..81eb9477590 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 @@ -85,8 +85,8 @@ public class SimpleInMemoryRepository { if (!prefix.endsWith(".")) { prefix = prefix + "."; } - return new ArrayList(this.values.subMap(prefix, false, prefix + "~", true) - .values()); + return new ArrayList( + this.values.subMap(prefix, false, prefix + "~", true).values()); } public void setValues(ConcurrentNavigableMap values) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java index 2b8622f0ec9..b441727ae6a 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java @@ -47,7 +47,8 @@ public class AuthorizationAuditListener implements @Override public void onApplicationEvent(AbstractAuthorizationEvent event) { if (event instanceof AuthenticationCredentialsNotFoundEvent) { - onAuthenticationCredentialsNotFoundEvent((AuthenticationCredentialsNotFoundEvent) event); + onAuthenticationCredentialsNotFoundEvent( + (AuthenticationCredentialsNotFoundEvent) event); } else if (event instanceof AuthorizationFailureEvent) { onAuthorizationFailureEvent((AuthorizationFailureEvent) event); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriter.java index 3fbbe8db60f..307eb87d9a2 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriter.java @@ -39,8 +39,8 @@ import org.springframework.util.StringUtils; * * @since 1.2.0 */ -public class EmbeddedServerPortFileWriter implements - ApplicationListener { +public class EmbeddedServerPortFileWriter + implements ApplicationListener { private static final String DEFAULT_FILE_NAME = "application.port"; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/SystemProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/SystemProperties.java index f256c5c2f10..68f66bfaeb3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/SystemProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/SystemProperties.java @@ -36,8 +36,8 @@ final class SystemProperties { } } catch (Throwable ex) { - System.err.println("Could not resolve '" + property - + "' as system property: " + ex); + System.err.println( + "Could not resolve '" + property + "' as system property: " + ex); } } return null; 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 410364a27e4..df85cd81a37 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 @@ -85,7 +85,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) - throws ServletException, IOException { + throws ServletException, IOException { Map trace = getTrace(request); if (this.logger.isTraceEnabled()) { @@ -147,8 +147,8 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order .getAttribute("javax.servlet.error.exception"); if (exception != null && this.errorAttributes != null) { RequestAttributes requestAttributes = new ServletRequestAttributes(request); - Map error = this.errorAttributes.getErrorAttributes( - requestAttributes, true); + Map error = this.errorAttributes + .getErrorAttributes(requestAttributes, true); trace.put("error", error); } return trace; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java index 9fe24d833de..844cbc44281 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java @@ -32,8 +32,8 @@ public class AuditEventTests { @Test public void testNowEvent() throws Exception { - AuditEvent event = new AuditEvent("phil", "UNKNOWN", Collections.singletonMap( - "a", (Object) "b")); + AuditEvent event = new AuditEvent("phil", "UNKNOWN", + Collections.singletonMap("a", (Object) "b")); assertEquals("b", event.getData().get("a")); assertEquals("UNKNOWN", event.getType()); assertEquals("phil", event.getPrincipal()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java index e4d54690c27..ee4ad90aedf 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java @@ -194,8 +194,8 @@ public class CrshAutoConfigurationTests { PluginContext pluginContext = lifeCycle.getContext(); int count = 0; - Iterator plugins = pluginContext.getPlugins( - AuthenticationPlugin.class).iterator(); + Iterator plugins = pluginContext + .getPlugins(AuthenticationPlugin.class).iterator(); while (plugins.hasNext()) { count++; plugins.next(); @@ -230,8 +230,8 @@ public class CrshAutoConfigurationTests { PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class); assertEquals("jaas", lifeCycle.getConfig().get("crash.auth")); - assertEquals("my-test-domain", lifeCycle.getConfig() - .get("crash.auth.jaas.domain")); + assertEquals("my-test-domain", + lifeCycle.getConfig().get("crash.auth.jaas.domain")); } @Test @@ -270,8 +270,8 @@ public class CrshAutoConfigurationTests { AuthenticationPlugin authenticationPlugin = null; String authentication = lifeCycle.getConfig().getProperty("crash.auth"); assertNotNull(authentication); - for (AuthenticationPlugin plugin : lifeCycle.getContext().getPlugins( - AuthenticationPlugin.class)) { + for (AuthenticationPlugin plugin : lifeCycle.getContext() + .getPlugins(AuthenticationPlugin.class)) { if (authentication.equals(plugin.getName())) { authenticationPlugin = plugin; break; @@ -299,8 +299,8 @@ public class CrshAutoConfigurationTests { AuthenticationPlugin authenticationPlugin = null; String authentication = lifeCycle.getConfig().getProperty("crash.auth"); assertNotNull(authentication); - for (AuthenticationPlugin plugin : lifeCycle.getContext().getPlugins( - AuthenticationPlugin.class)) { + for (AuthenticationPlugin plugin : lifeCycle.getContext() + .getPlugins(AuthenticationPlugin.class)) { if (authentication.equals(plugin.getName())) { authenticationPlugin = plugin; break; @@ -314,7 +314,8 @@ public class CrshAutoConfigurationTests { } @Test - public void testSpringAuthenticationProviderAsDefaultConfiguration() throws Exception { + public void testSpringAuthenticationProviderAsDefaultConfiguration() + throws Exception { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(ManagementServerPropertiesAutoConfiguration.class); @@ -328,8 +329,8 @@ public class CrshAutoConfigurationTests { AuthenticationPlugin authenticationPlugin = null; String authentication = lifeCycle.getConfig().getProperty("crash.auth"); assertNotNull(authentication); - for (AuthenticationPlugin plugin : lifeCycle.getContext().getPlugins( - AuthenticationPlugin.class)) { + for (AuthenticationPlugin plugin : lifeCycle.getContext() + .getPlugins(AuthenticationPlugin.class)) { if (authentication.equals(plugin.getName())) { authenticationPlugin = plugin; break; @@ -360,12 +361,12 @@ public class CrshAutoConfigurationTests { && authentication.getCredentials().equals(PASSWORD)) { authentication = new UsernamePasswordAuthenticationToken( authentication.getPrincipal(), - authentication.getCredentials(), - Collections + authentication.getCredentials(), Collections .singleton(new SimpleGrantedAuthority("ADMIN"))); } else { - throw new BadCredentialsException("Invalid username and password"); + throw new BadCredentialsException( + "Invalid username and password"); } return authentication; } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfigurationTests.java index 9ec021b8f32..238a01ad34e 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfigurationTests.java @@ -98,8 +98,7 @@ public class EndpointMBeanExportAutoConfigurationTests { throws Exception { this.context = new AnnotationConfigApplicationContext(); this.context.register(TestConfiguration.class, JmxAutoConfiguration.class, - NestedInManagedEndpoint.class, - EndpointMBeanExportAutoConfiguration.class, + NestedInManagedEndpoint.class, EndpointMBeanExportAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); assertNotNull(this.context.getBean(EndpointMBeanExporter.class)); @@ -116,8 +115,7 @@ public class EndpointMBeanExportAutoConfigurationTests { environment.setProperty("endpoints.jmx.enabled", "false"); this.context = new AnnotationConfigApplicationContext(); this.context.setEnvironment(environment); - this.context.register(JmxAutoConfiguration.class, - EndpointAutoConfiguration.class, + this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class, EndpointMBeanExportAutoConfiguration.class); this.context.refresh(); this.context.getBean(EndpointMBeanExporter.class); @@ -133,26 +131,24 @@ public class EndpointMBeanExportAutoConfigurationTests { environment.setProperty("endpoints.jmx.static_names", "key1=value1, key2=value2"); this.context = new AnnotationConfigApplicationContext(); this.context.setEnvironment(environment); - this.context.register(JmxAutoConfiguration.class, - EndpointAutoConfiguration.class, + this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class, EndpointMBeanExportAutoConfiguration.class); this.context.refresh(); this.context.getBean(EndpointMBeanExporter.class); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); - assertNotNull(mbeanExporter.getServer().getMBeanInfo( - ObjectNameManager.getInstance(getObjectName("test-domain", - "healthEndpoint", this.context).toString() - + ",key1=value1,key2=value2"))); + assertNotNull(mbeanExporter.getServer() + .getMBeanInfo(ObjectNameManager.getInstance( + getObjectName("test-domain", "healthEndpoint", this.context) + .toString() + ",key1=value1,key2=value2"))); } @Test public void testEndpointMBeanExporterInParentChild() throws IntrospectionException, InstanceNotFoundException, MalformedObjectNameException, ReflectionException { this.context = new AnnotationConfigApplicationContext(); - this.context.register(JmxAutoConfiguration.class, - EndpointAutoConfiguration.class, + this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class, EndpointMBeanExportAutoConfiguration.class); AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext(); @@ -174,10 +170,8 @@ public class EndpointMBeanExportAutoConfigurationTests { } if (applicationContext.getEnvironment().getProperty("endpoints.jmx.unique_names", Boolean.class, false)) { - name = name - + ",identity=" - + ObjectUtils.getIdentityHexString(applicationContext - .getBean(beanKey)); + name = name + ",identity=" + ObjectUtils + .getIdentityHexString(applicationContext.getBean(beanKey)); } if (applicationContext.getParent() != null) { return ObjectNameManager.getInstance(String.format(name, domain, beanKey, diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java index 89ddd93a1c3..be23920e801 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java @@ -85,8 +85,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ApplicationHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -142,8 +142,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(RedisHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(RedisHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -157,8 +157,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ApplicationHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -172,8 +172,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(MongoHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(MongoHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -188,8 +188,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ApplicationHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -213,8 +213,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(DataSourceHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(DataSourceHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -248,8 +248,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ApplicationHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -262,8 +262,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(RabbitHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(RabbitHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -277,8 +277,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ApplicationHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -291,8 +291,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(SolrHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(SolrHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -306,8 +306,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ApplicationHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -317,8 +317,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(DiskSpaceHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(DiskSpaceHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java index bd0f7c1949a..be05f519842 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java @@ -73,7 +73,8 @@ public class JolokiaAutoConfigurationTests { HttpMessageConvertersAutoConfiguration.class, JolokiaAutoConfiguration.class); this.context.refresh(); - assertEquals(1, this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length); + assertEquals(1, + this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length); } @Test @@ -106,7 +107,8 @@ public class JolokiaAutoConfigurationTests { @Test public void endpointEnabledAsOverride() throws Exception { - assertEndpointEnabled("endpoints.enabled:false", "endpoints.jolokia.enabled:true"); + assertEndpointEnabled("endpoints.enabled:false", + "endpoints.jolokia.enabled:true"); } private void assertEndpointDisabled(String... pairs) { @@ -118,7 +120,8 @@ public class JolokiaAutoConfigurationTests { HttpMessageConvertersAutoConfiguration.class, JolokiaAutoConfiguration.class); this.context.refresh(); - assertEquals(0, this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length); + assertEquals(0, + this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length); } private void assertEndpointEnabled(String... pairs) { @@ -130,7 +133,8 @@ public class JolokiaAutoConfigurationTests { HttpMessageConvertersAutoConfiguration.class, JolokiaAutoConfiguration.class); this.context.refresh(); - assertEquals(1, this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length); + assertEquals(1, + this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length); } @Configuration diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java index 041881131f4..17efe7498fc 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java @@ -110,10 +110,10 @@ public class MetricFilterAutoConfigurationTests { MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController()) .addFilter(filter).build(); mvc.perform(get("/templateVarTest/foo")).andExpect(status().isOk()); - verify(context.getBean(CounterService.class)).increment( - "status.200.templateVarTest.someVariable"); - verify(context.getBean(GaugeService.class)).submit( - eq("response.templateVarTest.someVariable"), anyDouble()); + verify(context.getBean(CounterService.class)) + .increment("status.200.templateVarTest.someVariable"); + verify(context.getBean(GaugeService.class)) + .submit(eq("response.templateVarTest.someVariable"), anyDouble()); context.close(); } @@ -126,10 +126,10 @@ public class MetricFilterAutoConfigurationTests { MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController()) .addFilter(filter).build(); mvc.perform(get("/knownPath/foo")).andExpect(status().isNotFound()); - verify(context.getBean(CounterService.class)).increment( - "status.404.knownPath.someVariable"); - verify(context.getBean(GaugeService.class)).submit( - eq("response.knownPath.someVariable"), anyDouble()); + verify(context.getBean(CounterService.class)) + .increment("status.404.knownPath.someVariable"); + verify(context.getBean(GaugeService.class)) + .submit(eq("response.knownPath.someVariable"), anyDouble()); context.close(); } @@ -142,10 +142,10 @@ public class MetricFilterAutoConfigurationTests { .addFilter(filter).build(); mvc.perform(get("/unknownPath/1")).andExpect(status().isNotFound()); mvc.perform(get("/unknownPath/2")).andExpect(status().isNotFound()); - verify(context.getBean(CounterService.class), times(2)).increment( - "status.404.unmapped"); - verify(context.getBean(GaugeService.class), times(2)).submit( - eq("response.unmapped"), anyDouble()); + verify(context.getBean(CounterService.class), times(2)) + .increment("status.404.unmapped"); + verify(context.getBean(GaugeService.class), times(2)) + .submit(eq("response.unmapped"), anyDouble()); context.close(); } @@ -159,10 +159,10 @@ public class MetricFilterAutoConfigurationTests { .build(); mvc.perform(get("/unknownPath/1")).andExpect(status().is3xxRedirection()); mvc.perform(get("/unknownPath/2")).andExpect(status().is3xxRedirection()); - verify(context.getBean(CounterService.class), times(2)).increment( - "status.302.unmapped"); - verify(context.getBean(GaugeService.class), times(2)).submit( - eq("response.unmapped"), anyDouble()); + verify(context.getBean(CounterService.class), times(2)) + .increment("status.302.unmapped"); + verify(context.getBean(GaugeService.class), times(2)) + .submit(eq("response.unmapped"), anyDouble()); context.close(); } @@ -182,16 +182,16 @@ public class MetricFilterAutoConfigurationTests { MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController()) .addFilter(filter).build(); try { - mvc.perform(get("/unhandledException")).andExpect( - status().isInternalServerError()); + mvc.perform(get("/unhandledException")) + .andExpect(status().isInternalServerError()); } catch (NestedServletException ex) { // Expected } - verify(context.getBean(CounterService.class)).increment( - "status.500.unhandledException"); - verify(context.getBean(GaugeService.class)).submit( - eq("response.unhandledException"), anyDouble()); + verify(context.getBean(CounterService.class)) + .increment("status.500.unhandledException"); + verify(context.getBean(GaugeService.class)) + .submit(eq("response.unhandledException"), anyDouble()); context.close(); } @@ -206,10 +206,10 @@ public class MetricFilterAutoConfigurationTests { MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController()) .addFilter(filter).build(); mvc.perform(get("/templateVarTest/foo")).andExpect(status().isOk()); - verify(context.getBean(CounterService.class)).increment( - "status.200.templateVarTest.someVariable"); - verify(context.getBean(GaugeService.class)).submit( - eq("response.templateVarTest.someVariable"), anyDouble()); + verify(context.getBean(CounterService.class)) + .increment("status.200.templateVarTest.someVariable"); + verify(context.getBean(GaugeService.class)) + .submit(eq("response.templateVarTest.someVariable"), anyDouble()); context.close(); } @@ -235,7 +235,8 @@ public class MetricFilterAutoConfigurationTests { } @Test - public void correctlyRecordsMetricsForFailedDeferredResultResponse() throws Exception { + public void correctlyRecordsMetricsForFailedDeferredResultResponse() + throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( Config.class, MetricFilterAutoConfiguration.class); MetricsFilter filter = context.getBean(MetricsFilter.class); @@ -255,8 +256,8 @@ public class MetricFilterAutoConfigurationTests { } catch (Exception ex) { assertThat(result.getRequest().getAttribute(attributeName), is(nullValue())); - verify(context.getBean(CounterService.class)).increment( - "status.500.createFailure"); + verify(context.getBean(CounterService.class)) + .increment("status.500.createFailure"); } finally { context.close(); @@ -317,8 +318,8 @@ public class MetricFilterAutoConfigurationTests { public void run() { try { MetricFilterTestController.this.latch.await(); - result.setResult(new ResponseEntity("Done", - HttpStatus.CREATED)); + result.setResult( + new ResponseEntity("Done", HttpStatus.CREATED)); } catch (InterruptedException ex) { } @@ -353,8 +354,8 @@ public class MetricFilterAutoConfigurationTests { @Override protected void doFilterInternal(HttpServletRequest request, - HttpServletResponse response, FilterChain chain) throws ServletException, - IOException { + HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { // send redirect before filter chain is executed, like Spring Security sending // us back to a login page response.sendRedirect("http://example.com"); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java index 18e14fbb23d..8444a2820ea 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java @@ -56,8 +56,8 @@ public class ShellPropertiesTests { public void testBindingAuth() { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); - binder.bind(new MutablePropertyValues(Collections.singletonMap("shell.auth", - "spring"))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("shell.auth", "spring"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals("spring", props.getAuth()); } @@ -66,7 +66,8 @@ public class ShellPropertiesTests { public void testBindingAuthIfEmpty() { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); - binder.bind(new MutablePropertyValues(Collections.singletonMap("shell.auth", ""))); + binder.bind( + new MutablePropertyValues(Collections.singletonMap("shell.auth", ""))); assertTrue(binder.getBindingResult().hasErrors()); assertEquals("simple", props.getAuth()); } @@ -76,8 +77,8 @@ public class ShellPropertiesTests { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.command_refresh_interval", "1"))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("shell.command_refresh_interval", "1"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(1, props.getCommandRefreshInterval()); } @@ -87,8 +88,8 @@ public class ShellPropertiesTests { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.command_path_patterns", "pattern1, pattern2"))); + binder.bind(new MutablePropertyValues(Collections + .singletonMap("shell.command_path_patterns", "pattern1, pattern2"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(2, props.getCommandPathPatterns().length); Assert.assertArrayEquals(new String[] { "pattern1", "pattern2" }, @@ -100,8 +101,8 @@ public class ShellPropertiesTests { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.config_path_patterns", "pattern1, pattern2"))); + binder.bind(new MutablePropertyValues(Collections + .singletonMap("shell.config_path_patterns", "pattern1, pattern2"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(2, props.getConfigPathPatterns().length); Assert.assertArrayEquals(new String[] { "pattern1", "pattern2" }, @@ -113,8 +114,8 @@ public class ShellPropertiesTests { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.disabled_plugins", "pattern1, pattern2"))); + binder.bind(new MutablePropertyValues(Collections + .singletonMap("shell.disabled_plugins", "pattern1, pattern2"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(2, props.getDisabledPlugins().length); assertArrayEquals(new String[] { "pattern1", "pattern2" }, @@ -126,8 +127,8 @@ public class ShellPropertiesTests { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.disabled_commands", "pattern1, pattern2"))); + binder.bind(new MutablePropertyValues(Collections + .singletonMap("shell.disabled_commands", "pattern1, pattern2"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(2, props.getDisabledCommands().length); assertArrayEquals(new String[] { "pattern1", "pattern2" }, @@ -271,8 +272,8 @@ public class ShellPropertiesTests { public void testDefaultPasswordAutogeneratedIfUnresolovedPlaceholder() { SimpleAuthenticationProperties security = new SimpleAuthenticationProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(security, "security"); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.auth.simple.user.password", "${ADMIN_PASSWORD}"))); + binder.bind(new MutablePropertyValues(Collections + .singletonMap("shell.auth.simple.user.password", "${ADMIN_PASSWORD}"))); assertFalse(binder.getBindingResult().hasErrors()); assertTrue(security.getUser().isDefaultPassword()); } @@ -281,8 +282,8 @@ public class ShellPropertiesTests { public void testDefaultPasswordAutogeneratedIfEmpty() { SimpleAuthenticationProperties security = new SimpleAuthenticationProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(security, "security"); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.auth.simple.user.password", ""))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("shell.auth.simple.user.password", ""))); assertFalse(binder.getBindingResult().hasErrors()); assertTrue(security.getUser().isDefaultPassword()); } @@ -291,8 +292,8 @@ public class ShellPropertiesTests { public void testBindingSpring() { SpringAuthenticationProperties props = new SpringAuthenticationProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.spring"); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.auth.spring.roles", "role1, role2"))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("shell.auth.spring.roles", "role1, role2"))); assertFalse(binder.getBindingResult().hasErrors()); Properties p = new Properties(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java index cceacf479aa..f0de95929c1 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java @@ -116,9 +116,8 @@ public abstract class AbstractEndpointTests> { @Test public void isEnabledFallbackToEnvironment() throws Exception { this.context = new AnnotationConfigApplicationContext(); - PropertySource propertySource = new MapPropertySource("test", - Collections.singletonMap(this.property + ".enabled", - false)); + PropertySource propertySource = new MapPropertySource("test", Collections + .singletonMap(this.property + ".enabled", false)); this.context.getEnvironment().getPropertySources().addFirst(propertySource); this.context.register(this.configClass); this.context.refresh(); @@ -129,9 +128,8 @@ public abstract class AbstractEndpointTests> { @SuppressWarnings("rawtypes") public void isExplicitlyEnabled() throws Exception { this.context = new AnnotationConfigApplicationContext(); - PropertySource propertySource = new MapPropertySource("test", - Collections.singletonMap(this.property + ".enabled", - false)); + PropertySource propertySource = new MapPropertySource("test", Collections + .singletonMap(this.property + ".enabled", false)); this.context.getEnvironment().getPropertySources().addFirst(propertySource); this.context.register(this.configClass); this.context.refresh(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java index d2152b376dc..d5dc65d1fca 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java @@ -42,8 +42,8 @@ import static org.mockito.Mockito.mock; * @author Phillip Webb * @author Andy Wilkinson */ -public class AutoConfigurationReportEndpointTests extends - AbstractEndpointTests { +public class AutoConfigurationReportEndpointTests + extends AbstractEndpointTests { public AutoConfigurationReportEndpointTests() { super(Config.class, AutoConfigurationReportEndpoint.class, "autoconfig", true, @@ -70,8 +70,8 @@ public class AutoConfigurationReportEndpointTests extends @PostConstruct public void setupAutoConfigurationReport() { - ConditionEvaluationReport report = ConditionEvaluationReport.get(this.context - .getBeanFactory()); + ConditionEvaluationReport report = ConditionEvaluationReport + .get(this.context.getBeanFactory()); report.recordConditionEvaluation("a", mock(Condition.class), mock(ConditionOutcome.class)); report.recordExclusions(Arrays.asList("com.foo.Bar")); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointProxyTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointProxyTests.java index b8f255ecc35..5a9d8153dd8 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointProxyTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointProxyTests.java @@ -66,8 +66,8 @@ public class ConfigurationPropertiesReportEndpointProxyTests { public void testWithProxyClass() throws Exception { this.context.register(Config.class, SqlExecutor.class); this.context.refresh(); - Map report = this.context.getBean( - ConfigurationPropertiesReportEndpoint.class).invoke(); + Map report = this.context + .getBean(ConfigurationPropertiesReportEndpoint.class).invoke(); assertThat(report.toString(), containsString("prefix=executor.sql")); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java index 367263015db..6da3fb174d1 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java @@ -37,8 +37,8 @@ import static org.junit.Assert.assertThat; * * @author Dave Syer */ -public class ConfigurationPropertiesReportEndpointTests extends - AbstractEndpointTests { +public class ConfigurationPropertiesReportEndpointTests + extends AbstractEndpointTests { public ConfigurationPropertiesReportEndpointTests() { super(Config.class, ConfigurationPropertiesReportEndpoint.class, "configprops", diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java index 664702b3389..53703cb751b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java @@ -56,10 +56,10 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests env = report.invoke(); assertEquals("bar", ((Map) env.get("composite:one")).get("foo")); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java index 1c282de0d15..585e417ec8b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java @@ -62,8 +62,8 @@ public class MetricsEndpointTests extends AbstractEndpointTests @Test public void ordered() { List publicMetrics = new ArrayList(); - publicMetrics.add(new TestPublicMetrics(2, this.metric2, this.metric2, - this.metric3)); + publicMetrics + .add(new TestPublicMetrics(2, this.metric2, this.metric2, this.metric3)); publicMetrics.add(new TestPublicMetrics(1, this.metric1)); Map metrics = new MetricsEndpoint(publicMetrics).invoke(); Iterator> iterator = metrics.entrySet().iterator(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java index 0cf90b0066e..9509df3633a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java @@ -52,8 +52,8 @@ public class RequestMappingEndpointTests { mapping.setUrlMap(Collections.singletonMap("/foo", new Object())); mapping.setApplicationContext(new StaticApplicationContext()); mapping.initApplicationContext(); - this.endpoint.setHandlerMappings(Collections - .singletonList(mapping)); + this.endpoint.setHandlerMappings( + Collections.singletonList(mapping)); Map result = this.endpoint.invoke(); assertEquals(1, result.size()); @SuppressWarnings("unchecked") @@ -113,8 +113,8 @@ public class RequestMappingEndpointTests { Arrays.asList(new EndpointMvcAdapter(new DumpEndpoint()))); mapping.setApplicationContext(new StaticApplicationContext()); mapping.afterPropertiesSet(); - this.endpoint.setMethodMappings(Collections - .>singletonList(mapping)); + this.endpoint.setMethodMappings( + Collections.>singletonList(mapping)); Map result = this.endpoint.invoke(); assertEquals(1, result.size()); assertTrue(result.keySet().iterator().next().contains("/dump")); 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 2ef9b44deb8..f04a8ccc5d5 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 @@ -56,15 +56,15 @@ public class EndpointHandlerMappingTests { public void withoutPrefix() throws Exception { TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("/a")); TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("/b")); - EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList( - endpointA, endpointB)); + EndpointHandlerMapping mapping = new EndpointHandlerMapping( + Arrays.asList(endpointA, endpointB)); mapping.setApplicationContext(this.context); mapping.afterPropertiesSet(); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")) - .getHandler(), + assertThat( + mapping.getHandler(new MockHttpServletRequest("GET", "/a")).getHandler(), equalTo((Object) new HandlerMethod(endpointA, this.method))); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/b")) - .getHandler(), + assertThat( + mapping.getHandler(new MockHttpServletRequest("GET", "/b")).getHandler(), equalTo((Object) new HandlerMethod(endpointB, this.method))); assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/c")), nullValue()); @@ -74,16 +74,18 @@ public class EndpointHandlerMappingTests { public void withPrefix() throws Exception { TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("/a")); TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("/b")); - EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList( - endpointA, endpointB)); + EndpointHandlerMapping mapping = new EndpointHandlerMapping( + Arrays.asList(endpointA, endpointB)); mapping.setApplicationContext(this.context); mapping.setPrefix("/a"); mapping.afterPropertiesSet(); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a/a")) - .getHandler(), + assertThat( + mapping.getHandler(new MockHttpServletRequest("GET", "/a/a")) + .getHandler(), equalTo((Object) new HandlerMethod(endpointA, this.method))); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a/b")) - .getHandler(), + assertThat( + mapping.getHandler(new MockHttpServletRequest("GET", "/a/b")) + .getHandler(), equalTo((Object) new HandlerMethod(endpointB, this.method))); assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")), nullValue()); @@ -137,8 +139,8 @@ public class EndpointHandlerMappingTests { public void duplicatePath() throws Exception { TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("/a")); TestActionEndpoint other = new TestActionEndpoint(new TestEndpoint("/a")); - EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList( - endpoint, other)); + EndpointHandlerMapping mapping = new EndpointHandlerMapping( + Arrays.asList(endpoint, other)); mapping.setDisabled(true); mapping.setApplicationContext(this.context); mapping.afterPropertiesSet(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java index 26d89adc326..457c7bc5a9f 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java @@ -51,7 +51,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Dave Syer */ @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = { Config.class }, initializers = ContextPathListener.class) +@SpringApplicationConfiguration(classes = { + Config.class }, initializers = ContextPathListener.class) @WebAppConfiguration public class JolokiaMvcEndpointContextPathTests { @@ -63,8 +64,8 @@ public class JolokiaMvcEndpointContextPathTests { @Before public void setUp() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build(); - EnvironmentTestUtils.addEnvironment( - (ConfigurableApplicationContext) this.context, "foo:bar"); + EnvironmentTestUtils.addEnvironment((ConfigurableApplicationContext) this.context, + "foo:bar"); } @Test @@ -84,8 +85,8 @@ public class JolokiaMvcEndpointContextPathTests { public static class Config { } - public static class ContextPathListener implements - ApplicationContextInitializer { + public static class ContextPathListener + implements ApplicationContextInitializer { @Override public void initialize(ConfigurableApplicationContext context) { EnvironmentTestUtils.addEnvironment(context, "management.contextPath:/admin"); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java index 2200033c02f..83f92cdabeb 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java @@ -72,8 +72,8 @@ public class JolokiaMvcEndpointTests { @Before public void setUp() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build(); - EnvironmentTestUtils.addEnvironment( - (ConfigurableApplicationContext) this.context, "foo:bar"); + EnvironmentTestUtils.addEnvironment((ConfigurableApplicationContext) this.context, + "foo:bar"); } @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java index ea39c588de2..9cc7220eb7e 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java @@ -55,12 +55,12 @@ public class CompositeHealthIndicatorTests { @Before public void setup() { MockitoAnnotations.initMocks(this); - given(this.one.health()).willReturn( - new Health.Builder().unknown().withDetail("1", "1").build()); - given(this.two.health()).willReturn( - new Health.Builder().unknown().withDetail("2", "2").build()); - given(this.three.health()).willReturn( - new Health.Builder().unknown().withDetail("3", "3").build()); + given(this.one.health()) + .willReturn(new Health.Builder().unknown().withDetail("1", "1").build()); + given(this.two.health()) + .willReturn(new Health.Builder().unknown().withDetail("2", "2").build()); + given(this.three.health()) + .willReturn(new Health.Builder().unknown().withDetail("3", "3").build()); this.healthAggregator = new OrderedHealthAggregator(); } @@ -74,16 +74,10 @@ public class CompositeHealthIndicatorTests { this.healthAggregator, indicators); Health result = composite.health(); assertThat(result.getDetails().size(), equalTo(2)); - assertThat( - result.getDetails(), - hasEntry("one", - (Object) new Health.Builder().unknown().withDetail("1", "1") - .build())); - assertThat( - result.getDetails(), - hasEntry("two", - (Object) new Health.Builder().unknown().withDetail("2", "2") - .build())); + assertThat(result.getDetails(), hasEntry("one", + (Object) new Health.Builder().unknown().withDetail("1", "1").build())); + assertThat(result.getDetails(), hasEntry("two", + (Object) new Health.Builder().unknown().withDetail("2", "2").build())); } @Test @@ -96,21 +90,12 @@ public class CompositeHealthIndicatorTests { composite.addHealthIndicator("three", this.three); Health result = composite.health(); assertThat(result.getDetails().size(), equalTo(3)); - assertThat( - result.getDetails(), - hasEntry("one", - (Object) new Health.Builder().unknown().withDetail("1", "1") - .build())); - assertThat( - result.getDetails(), - hasEntry("two", - (Object) new Health.Builder().unknown().withDetail("2", "2") - .build())); - assertThat( - result.getDetails(), - hasEntry("three", - (Object) new Health.Builder().unknown().withDetail("3", "3") - .build())); + assertThat(result.getDetails(), hasEntry("one", + (Object) new Health.Builder().unknown().withDetail("1", "1").build())); + assertThat(result.getDetails(), hasEntry("two", + (Object) new Health.Builder().unknown().withDetail("2", "2").build())); + assertThat(result.getDetails(), hasEntry("three", + (Object) new Health.Builder().unknown().withDetail("3", "3").build())); } @Test @@ -121,16 +106,10 @@ public class CompositeHealthIndicatorTests { composite.addHealthIndicator("two", this.two); Health result = composite.health(); assertThat(result.getDetails().size(), equalTo(2)); - assertThat( - result.getDetails(), - hasEntry("one", - (Object) new Health.Builder().unknown().withDetail("1", "1") - .build())); - assertThat( - result.getDetails(), - hasEntry("two", - (Object) new Health.Builder().unknown().withDetail("2", "2") - .build())); + assertThat(result.getDetails(), hasEntry("one", + (Object) new Health.Builder().unknown().withDetail("1", "1").build())); + assertThat(result.getDetails(), hasEntry("two", + (Object) new Health.Builder().unknown().withDetail("2", "2").build())); } @Test @@ -147,9 +126,10 @@ public class CompositeHealthIndicatorTests { Health result = composite.health(); ObjectMapper mapper = new ObjectMapper(); - assertEquals("{\"status\":\"UNKNOWN\",\"db\":{\"status\":\"UNKNOWN\"" - + ",\"db1\":{\"status\":\"UNKNOWN\",\"1\":\"1\"}," - + "\"db2\":{\"status\":\"UNKNOWN\",\"2\":\"2\"}}}", + assertEquals( + "{\"status\":\"UNKNOWN\",\"db\":{\"status\":\"UNKNOWN\"" + + ",\"db1\":{\"status\":\"UNKNOWN\",\"1\":\"1\"}," + + "\"db2\":{\"status\":\"UNKNOWN\",\"2\":\"2\"}}}", mapper.writeValueAsString(result)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java index 5dbcc11d8f9..39af41d6474 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java @@ -99,8 +99,8 @@ public class DataSourceHealthIndicatorTests { public void connectionClosed() throws Exception { DataSource dataSource = mock(DataSource.class); Connection connection = mock(Connection.class); - given(connection.getMetaData()).willReturn( - this.dataSource.getConnection().getMetaData()); + given(connection.getMetaData()) + .willReturn(this.dataSource.getConnection().getMetaData()); given(dataSource.getConnection()).willReturn(connection); this.indicator.setDataSource(dataSource); Health health = this.indicator.health(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorTests.java index 1cdf55cb3c1..69a9c0cdafe 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorTests.java @@ -51,8 +51,8 @@ public class DiskSpaceHealthIndicatorTests { public void setUp() throws Exception { given(this.fileMock.exists()).willReturn(true); given(this.fileMock.canRead()).willReturn(true); - this.healthIndicator = new DiskSpaceHealthIndicator(createProperties( - this.fileMock, THRESHOLD_BYTES)); + this.healthIndicator = new DiskSpaceHealthIndicator( + createProperties(this.fileMock, THRESHOLD_BYTES)); } @Test @@ -77,7 +77,8 @@ public class DiskSpaceHealthIndicatorTests { assertEquals(THRESHOLD_BYTES * 10, health.getDetails().get("total")); } - private DiskSpaceHealthIndicatorProperties createProperties(File path, long threshold) { + private DiskSpaceHealthIndicatorProperties createProperties(File path, + long threshold) { DiskSpaceHealthIndicatorProperties properties = new DiskSpaceHealthIndicatorProperties(); properties.setPath(path); properties.setThreshold(threshold); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java index f73f30f8877..ad2abdada97 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java @@ -83,8 +83,8 @@ public class MongoHealthIndicatorTests { @Test public void mongoIsDown() throws Exception { MongoTemplate mongoTemplate = mock(MongoTemplate.class); - given(mongoTemplate.executeCommand("{ buildInfo: 1 }")).willThrow( - new MongoException("Connection failed")); + given(mongoTemplate.executeCommand("{ buildInfo: 1 }")) + .willThrow(new MongoException("Connection failed")); MongoHealthIndicator healthIndicator = new MongoHealthIndicator(mongoTemplate); Health health = healthIndicator.health(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java index 5516e028c75..a2185250ac6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java @@ -58,7 +58,8 @@ public class OrderedHealthAggregatorTests { healths.put("h2", new Health.Builder().status(Status.UP).build()); healths.put("h3", new Health.Builder().status(Status.UNKNOWN).build()); healths.put("h4", new Health.Builder().status(Status.OUT_OF_SERVICE).build()); - assertEquals(Status.UNKNOWN, this.healthAggregator.aggregate(healths).getStatus()); + assertEquals(Status.UNKNOWN, + this.healthAggregator.aggregate(healths).getStatus()); } @Test @@ -74,8 +75,8 @@ public class OrderedHealthAggregatorTests { @Test public void customOrderWithCustomStatus() { - this.healthAggregator.setStatusOrder(Arrays.asList("DOWN", "OUT_OF_SERVICE", - "UP", "UNKNOWN", "CUSTOM")); + this.healthAggregator.setStatusOrder( + Arrays.asList("DOWN", "OUT_OF_SERVICE", "UP", "UNKNOWN", "CUSTOM")); Map healths = new HashMap(); healths.put("h1", new Health.Builder().status(Status.DOWN).build()); healths.put("h2", new Health.Builder().status(Status.UP).build()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RabbitHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RabbitHealthIndicatorTests.java index 4220b88ad79..6e18e9dcc64 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RabbitHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RabbitHealthIndicatorTests.java @@ -47,9 +47,8 @@ public class RabbitHealthIndicatorTests { @Test public void indicatorExists() { this.context = new AnnotationConfigApplicationContext( - PropertyPlaceholderAutoConfiguration.class, - RabbitAutoConfiguration.class, EndpointAutoConfiguration.class, - HealthIndicatorAutoConfiguration.class); + PropertyPlaceholderAutoConfiguration.class, RabbitAutoConfiguration.class, + EndpointAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); assertEquals(1, this.context.getBeanNamesForType(RabbitAdmin.class).length); RabbitHealthIndicator healthIndicator = this.context .getBean(RabbitHealthIndicator.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RedisHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RedisHealthIndicatorTests.java index c951e5a74e9..2ac915722ac 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RedisHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RedisHealthIndicatorTests.java @@ -70,7 +70,8 @@ public class RedisHealthIndicatorTests { info.put("redis_version", "2.8.9"); RedisConnection redisConnection = mock(RedisConnection.class); - RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class); + RedisConnectionFactory redisConnectionFactory = mock( + RedisConnectionFactory.class); given(redisConnectionFactory.getConnection()).willReturn(redisConnection); given(redisConnection.info()).willReturn(info); RedisHealthIndicator healthIndicator = new RedisHealthIndicator( @@ -87,10 +88,11 @@ public class RedisHealthIndicatorTests { @Test public void redisIsDown() throws Exception { RedisConnection redisConnection = mock(RedisConnection.class); - RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class); + RedisConnectionFactory redisConnectionFactory = mock( + RedisConnectionFactory.class); given(redisConnectionFactory.getConnection()).willReturn(redisConnection); - given(redisConnection.info()).willThrow( - new RedisConnectionFailureException("Connection failed")); + given(redisConnection.info()) + .willThrow(new RedisConnectionFailureException("Connection failed")); RedisHealthIndicator healthIndicator = new RedisHealthIndicator( redisConnectionFactory); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java index 9be99aece39..f9c2ca067d5 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java @@ -35,7 +35,8 @@ public class MultiMetricRichGaugeReaderTests { private MultiMetricRichGaugeReader reader = new MultiMetricRichGaugeReader( this.repository); private InMemoryRichGaugeRepository data = new InMemoryRichGaugeRepository(); - private RichGaugeExporter exporter = new RichGaugeExporter(this.data, this.repository); + private RichGaugeExporter exporter = new RichGaugeExporter(this.data, + this.repository); @Test public void countOne() { 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 0349376bd33..b5c455731fe 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 @@ -74,7 +74,8 @@ public class InMemoryRepositoryTests { this.repository.set("foo.bar", "one"); this.repository.set("foo.min", "two"); this.repository.set("foo.max", "three"); - assertEquals(3, ((Collection) this.repository.findAllWithPrefix("foo")).size()); + assertEquals(3, + ((Collection) this.repository.findAllWithPrefix("foo")).size()); } @Test 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 f8198156088..3786149725b 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 @@ -54,8 +54,8 @@ public class MessageChannelMetricWriterTests { @Override public Object answer(InvocationOnMock invocation) throws Throwable { - MessageChannelMetricWriterTests.this.handler.handleMessage(invocation - .getArgumentAt(0, Message.class)); + MessageChannelMetricWriterTests.this.handler + .handleMessage(invocation.getArgumentAt(0, Message.class)); return true; } 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 94b0be51ffd..2b96ef66d8e 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 @@ -39,7 +39,8 @@ public class AuthenticationAuditListenerTests { private final AuthenticationAuditListener listener = new AuthenticationAuditListener(); - private final ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class); + private final ApplicationEventPublisher publisher = mock( + ApplicationEventPublisher.class); @Before public void init() { @@ -64,9 +65,9 @@ public class AuthenticationAuditListenerTests { @Test public void testAuthenticationSwitch() { this.listener.onApplicationEvent(new AuthenticationSwitchUserEvent( - new UsernamePasswordAuthenticationToken("user", "password"), new User( - "user", "password", AuthorityUtils - .commaSeparatedStringToAuthorityList("USER")))); + new UsernamePasswordAuthenticationToken("user", "password"), + new User("user", "password", + AuthorityUtils.commaSeparatedStringToAuthorityList("USER")))); verify(this.publisher).publishEvent((ApplicationEvent) anyObject()); } 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 1ba2b3082e9..f5ce55d1f50 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 @@ -39,7 +39,8 @@ public class AuthorizationAuditListenerTests { private final AuthorizationAuditListener listener = new AuthorizationAuditListener(); - private final ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class); + private final ApplicationEventPublisher publisher = mock( + ApplicationEventPublisher.class); @Before public void init() { @@ -48,8 +49,8 @@ public class AuthorizationAuditListenerTests { @Test public void testAuthenticationSuccess() { - this.listener.onApplicationEvent(new AuthorizationFailureEvent(this, Arrays - .asList(new SecurityConfig("USER")), + this.listener.onApplicationEvent(new AuthorizationFailureEvent(this, + Arrays.asList(new SecurityConfig("USER")), new UsernamePasswordAuthenticationToken("user", "password"), new AccessDeniedException("Bad user"))); verify(this.publisher).publishEvent((ApplicationEvent) anyObject()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriterTests.java index 5393cf0c55a..f1cc5a2970c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriterTests.java @@ -70,8 +70,8 @@ public class EmbeddedServerPortFileWriterTests { System.setProperty("PORTFILE", this.temporaryFolder.newFile().getAbsolutePath()); EmbeddedServerPortFileWriter listener = new EmbeddedServerPortFileWriter(file); listener.onApplicationEvent(mockEvent("", 8080)); - assertThat(FileCopyUtils.copyToString(new FileReader(System - .getProperty("PORTFILE"))), equalTo("8080")); + assertThat(FileCopyUtils.copyToString( + new FileReader(System.getProperty("PORTFILE"))), equalTo("8080")); } @Test @@ -86,8 +86,10 @@ public class EmbeddedServerPortFileWriterTests { - StringUtils.getFilenameExtension(managementFile).length() - 1); managementFile = managementFile + "-management." + StringUtils.getFilenameExtension(file.getName()); - assertThat(FileCopyUtils.copyToString(new FileReader(new File(file - .getParentFile(), managementFile))), equalTo("9090")); + assertThat( + FileCopyUtils.copyToString( + new FileReader(new File(file.getParentFile(), managementFile))), + equalTo("9090")); assertThat(collectFileNames(file.getParentFile()), hasItem(managementFile)); } @@ -102,13 +104,16 @@ public class EmbeddedServerPortFileWriterTests { - StringUtils.getFilenameExtension(managementFile).length() - 1); managementFile = managementFile + "-MANAGEMENT." + StringUtils.getFilenameExtension(file.getName()); - assertThat(FileCopyUtils.copyToString(new FileReader(new File(file - .getParentFile(), managementFile))), equalTo("9090")); + assertThat( + FileCopyUtils.copyToString( + new FileReader(new File(file.getParentFile(), managementFile))), + equalTo("9090")); assertThat(collectFileNames(file.getParentFile()), hasItem(managementFile)); } private EmbeddedServletContainerInitializedEvent mockEvent(String name, int port) { - EmbeddedWebApplicationContext applicationContext = mock(EmbeddedWebApplicationContext.class); + EmbeddedWebApplicationContext applicationContext = mock( + EmbeddedWebApplicationContext.class); EmbeddedServletContainer source = mock(EmbeddedServletContainer.class); given(applicationContext.getNamespace()).willReturn(name); given(source.getPort()).willReturn(port); 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 24c0b05f351..d2fa44cfcad 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 @@ -56,8 +56,8 @@ public class WebRequestTraceFilterTests { this.filter.enhanceTrace(trace, response); @SuppressWarnings("unchecked") Map map = (Map) trace.get("headers"); - assertEquals("{Content-Type=application/json, status=200}", map.get("response") - .toString()); + assertEquals("{Content-Type=application/json, status=200}", + map.get("response").toString()); } @Test @@ -80,8 +80,8 @@ public class WebRequestTraceFilterTests { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo"); MockHttpServletResponse response = new MockHttpServletResponse(); response.setStatus(500); - request.setAttribute("javax.servlet.error.exception", new IllegalStateException( - "Foo")); + request.setAttribute("javax.servlet.error.exception", + new IllegalStateException("Foo")); response.addHeader("Content-Type", "application/json"); Map trace = this.filter.getTrace(request); this.filter.enhanceTrace(trace, response); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java index 88f3065dcbe..754da4248fb 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java @@ -110,8 +110,8 @@ public abstract class AutoConfigurationPackages { private static String[] addBasePackages( ConstructorArgumentValues constructorArguments, String[] packageNames) { - String[] existing = (String[]) constructorArguments.getIndexedArgumentValue(0, - String[].class).getValue(); + String[] existing = (String[]) constructorArguments + .getIndexedArgumentValue(0, String[].class).getValue(); Set merged = new LinkedHashSet(); merged.addAll(Arrays.asList(existing)); merged.addAll(Arrays.asList(packageNames)); 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 7f6207962a0..98e0f5dcff0 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 @@ -155,8 +155,8 @@ class AutoConfigurationSorter { } private Set getAnnotationValue(Class annotation) { - Map attributes = this.metadata.getAnnotationAttributes( - annotation.getName(), true); + Map attributes = this.metadata + .getAnnotationAttributes(annotation.getName(), true); if (attributes == null) { return Collections.emptySet(); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java index 1ba8aaf1a93..b96e5a81d69 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java @@ -43,30 +43,25 @@ import com.rabbitmq.client.Channel; *

* Registers the following beans: *

    - *
  • - * {@link org.springframework.amqp.rabbit.core.RabbitTemplate RabbitTemplate} if there is - * no other bean of the same type in the context.
  • - *
  • - * {@link org.springframework.amqp.rabbit.connection.CachingConnectionFactory + *
  • {@link org.springframework.amqp.rabbit.core.RabbitTemplate RabbitTemplate} if there + * is no other bean of the same type in the context.
  • + *
  • {@link org.springframework.amqp.rabbit.connection.CachingConnectionFactory * CachingConnectionFactory} instance if there is no other bean of the same type in the * context.
  • - *
  • - * {@link org.springframework.amqp.core.AmqpAdmin } instance as long as + *
  • {@link org.springframework.amqp.core.AmqpAdmin } instance as long as * {@literal spring.rabbitmq.dynamic=true}.
  • *
*

* The {@link org.springframework.amqp.rabbit.connection.CachingConnectionFactory} honors * the following properties: *

    - *
  • - * {@literal spring.rabbitmq.port} is used to specify the port to which the client should - * connect, and defaults to 5672.
  • - *
  • - * {@literal spring.rabbitmq.username} is used to specify the (optional) username.
  • - *
  • - * {@literal spring.rabbitmq.password} is used to specify the (optional) password.
  • - *
  • - * {@literal spring.rabbitmq.host} is used to specify the host, and defaults to + *
  • {@literal spring.rabbitmq.port} is used to specify the port to which the client + * should connect, and defaults to 5672.
  • + *
  • {@literal spring.rabbitmq.username} is used to specify the (optional) username. + *
  • + *
  • {@literal spring.rabbitmq.password} is used to specify the (optional) password. + *
  • + *
  • {@literal spring.rabbitmq.host} is used to specify the host, and defaults to * {@literal localhost}.
  • *
  • {@literal spring.rabbitmq.virtualHost} is used to specify the (optional) virtual * host to which the client should connect.
  • diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java index 170ee294491..fc25f2952c2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java @@ -142,8 +142,8 @@ public class RabbitProperties { } result.add(address); } - return (result.isEmpty() ? null : StringUtils - .collectionToCommaDelimitedString(result)); + return (result.isEmpty() ? null + : StringUtils.collectionToCommaDelimitedString(result)); } public void setPort(int port) { 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 29f76b3e398..8ba58c37a5f 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 @@ -137,7 +137,8 @@ class BasicBatchConfigurer implements BatchConfigurer { JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); factory.setDataSource(this.dataSource); if (this.entityManagerFactory != null) { - logger.warn("JPA does not support custom isolation levels, so locks may not be taken when launching Jobs"); + logger.warn( + "JPA does not support custom isolation levels, so locks may not be taken when launching Jobs"); factory.setIsolationLevelForCreate("ISOLATION_DEFAULT"); } String tablePrefix = this.properties.getTablePrefix(); 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 5e016b6683e..074b8a48255 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 @@ -28,8 +28,8 @@ import org.springframework.context.ApplicationListener; * * @author Dave Syer */ -public class JobExecutionExitCodeGenerator implements - ApplicationListener, ExitCodeGenerator { +public class JobExecutionExitCodeGenerator + implements ApplicationListener, ExitCodeGenerator { private final List executions = new ArrayList(); 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 5b82a287e65..5c3ca8048e2 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 @@ -62,8 +62,8 @@ import org.springframework.util.StringUtils; * @author Jean-Pierre Bergamin */ @Component -public class JobLauncherCommandLineRunner implements CommandLineRunner, - ApplicationEventPublisherAware { +public class JobLauncherCommandLineRunner + implements CommandLineRunner, ApplicationEventPublisherAware { private static Log logger = LogFactory.getLog(JobLauncherCommandLineRunner.class); @@ -81,7 +81,8 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, private ApplicationEventPublisher publisher; - public JobLauncherCommandLineRunner(JobLauncher jobLauncher, JobExplorer jobExplorer) { + public JobLauncherCommandLineRunner(JobLauncher jobLauncher, + JobExplorer jobExplorer) { this.jobLauncher = jobLauncher; this.jobExplorer = jobExplorer; } @@ -123,7 +124,8 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, executeRegisteredJobs(jobParameters); } - private JobParameters getNextJobParameters(Job job, JobParameters additionalParameters) { + private JobParameters getNextJobParameters(Job job, + JobParameters additionalParameters) { String name = job.getName(); JobParameters parameters = new JobParameters(); List lastInstances = this.jobExplorer.getJobInstances(name, 0, 1); @@ -165,7 +167,8 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, } private void removeNonIdentifying(Map parameters) { - HashMap copy = new HashMap(parameters); + HashMap copy = new HashMap( + parameters); for (Map.Entry parameter : copy.entrySet()) { if (!parameter.getValue().isIdentifying()) { parameters.remove(parameter.getKey()); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java index ff3d06abb19..b5cac95c0f1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java @@ -96,8 +96,8 @@ abstract class BeanTypeRegistry { } private Class doGetFactoryBeanGeneric(ConfigurableListableBeanFactory beanFactory, - BeanDefinition definition, String name) throws Exception, - ClassNotFoundException, LinkageError { + BeanDefinition definition, String name) + throws Exception, ClassNotFoundException, LinkageError { if (StringUtils.hasLength(definition.getFactoryBeanName()) && StringUtils.hasLength(definition.getFactoryMethodName())) { return getConfigurationClassFactoryBeanGeneric(beanFactory, definition, name); @@ -116,8 +116,8 @@ abstract class BeanTypeRegistry { .as(FactoryBean.class).resolveGeneric(); if ((generic == null || generic.equals(Object.class)) && definition.hasAttribute(FACTORY_BEAN_OBJECT_TYPE)) { - generic = getTypeFromAttribute(definition - .getAttribute(FACTORY_BEAN_OBJECT_TYPE)); + generic = getTypeFromAttribute( + definition.getAttribute(FACTORY_BEAN_OBJECT_TYPE)); } return generic; } @@ -132,12 +132,12 @@ abstract class BeanTypeRegistry { .getIntrospectedMethod(); } } - BeanDefinition factoryDefinition = beanFactory.getBeanDefinition(definition - .getFactoryBeanName()); + BeanDefinition factoryDefinition = beanFactory + .getBeanDefinition(definition.getFactoryBeanName()); Class factoryClass = ClassUtils.forName(factoryDefinition.getBeanClassName(), beanFactory.getBeanClassLoader()); - return ReflectionUtils - .findMethod(factoryClass, definition.getFactoryMethodName()); + return ReflectionUtils.findMethod(factoryClass, + definition.getFactoryMethodName()); } private Class getDirectFactoryBeanGeneric( @@ -145,12 +145,12 @@ abstract class BeanTypeRegistry { String name) throws ClassNotFoundException, LinkageError { Class factoryBeanClass = ClassUtils.forName(definition.getBeanClassName(), beanFactory.getBeanClassLoader()); - Class generic = ResolvableType.forClass(factoryBeanClass) - .as(FactoryBean.class).resolveGeneric(); + Class generic = ResolvableType.forClass(factoryBeanClass).as(FactoryBean.class) + .resolveGeneric(); if ((generic == null || generic.equals(Object.class)) && definition.hasAttribute(FACTORY_BEAN_OBJECT_TYPE)) { - generic = getTypeFromAttribute(definition - .getAttribute(FACTORY_BEAN_OBJECT_TYPE)); + generic = getTypeFromAttribute( + definition.getAttribute(FACTORY_BEAN_OBJECT_TYPE)); } return generic; } @@ -195,8 +195,8 @@ abstract class BeanTypeRegistry { @Override public Set getNamesForType(Class type) { Set result = new LinkedHashSet(); - result.addAll(Arrays.asList(this.beanFactory.getBeanNamesForType(type, true, - false))); + result.addAll(Arrays + .asList(this.beanFactory.getBeanNamesForType(type, true, false))); if (this.beanFactory instanceof ConfigurableListableBeanFactory) { collectBeanNamesForTypeFromFactoryBeans(result, (ConfigurableListableBeanFactory) this.beanFactory, type); @@ -225,8 +225,8 @@ abstract class BeanTypeRegistry { * {@link BeanTypeRegistry} optimized for {@link DefaultListableBeanFactory} * implementations that allow eager class loading. */ - static class OptimizedBeanTypeRegistry extends BeanTypeRegistry implements - SmartInitializingSingleton { + static class OptimizedBeanTypeRegistry extends BeanTypeRegistry + implements SmartInitializingSingleton { private static final String BEAN_NAME = BeanTypeRegistry.class.getName(); @@ -249,7 +249,8 @@ abstract class BeanTypeRegistry { @Override public Set getNamesForType(Class type) { - if (this.lastBeanDefinitionCount != this.beanFactory.getBeanDefinitionCount()) { + if (this.lastBeanDefinitionCount != this.beanFactory + .getBeanDefinitionCount()) { Iterator names = this.beanFactory.getBeanNamesIterator(); while (names.hasNext()) { String name = names.next(); @@ -315,8 +316,8 @@ abstract class BeanTypeRegistry { private boolean requiresEagerInit(String factoryBeanName) { return (factoryBeanName != null - && this.beanFactory.isFactoryBean(factoryBeanName) && !this.beanFactory - .containsSingleton(factoryBeanName)); + && this.beanFactory.isFactoryBean(factoryBeanName) + && !this.beanFactory.containsSingleton(factoryBeanName)); } /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java index 95cf64a3559..7d0d7d2a844 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java @@ -112,7 +112,8 @@ public final class ConditionEvaluationReport { */ public Map getConditionAndOutcomesBySource() { if (!this.addedAncestorOutcomes) { - for (Map.Entry entry : this.outcomes.entrySet()) { + for (Map.Entry entry : this.outcomes + .entrySet()) { if (!entry.getValue().isFullMatch()) { addNoMatchOutcomeToAncestors(entry.getKey()); } @@ -126,8 +127,8 @@ public final class ConditionEvaluationReport { String prefix = source + "$"; for (Entry entry : this.outcomes.entrySet()) { if (entry.getKey().startsWith(prefix)) { - ConditionOutcome outcome = new ConditionOutcome(false, "Ancestor '" - + source + "' did not match"); + ConditionOutcome outcome = new ConditionOutcome(false, + "Ancestor '" + source + "' did not match"); entry.getValue().add(ANCESTOR_CONDITION, outcome); } } @@ -250,8 +251,8 @@ public final class ConditionEvaluationReport { } ConditionAndOutcome other = (ConditionAndOutcome) obj; return (ObjectUtils.nullSafeEquals(this.condition.getClass(), - other.condition.getClass()) && ObjectUtils.nullSafeEquals( - this.outcome, other.outcome)); + other.condition.getClass()) + && ObjectUtils.nullSafeEquals(this.outcome, other.outcome)); } @Override diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java index af7c0894da0..9d2b9cc6883 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java @@ -92,8 +92,8 @@ public class ConditionOutcome { } if (getClass() == obj.getClass()) { ConditionOutcome other = (ConditionOutcome) obj; - return (this.match == other.match && ObjectUtils.nullSafeEquals(this.message, - other.message)); + return (this.match == other.match + && ObjectUtils.nullSafeEquals(this.message, other.message)); } return super.equals(obj); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java index ec722975e21..1265db6a3db 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java @@ -57,15 +57,15 @@ class OnClassCondition extends SpringBootCondition { + StringUtils.collectionToCommaDelimitedString(missing)); } matchMessage.append("@ConditionalOnClass classes found: " - + StringUtils.collectionToCommaDelimitedString(getMatchingClasses( - onClasses, MatchType.PRESENT, context))); + + StringUtils.collectionToCommaDelimitedString( + getMatchingClasses(onClasses, MatchType.PRESENT, context))); } MultiValueMap onMissingClasses = getAttributes(metadata, ConditionalOnMissingClass.class); if (onMissingClasses != null) { - List present = getMatchingClasses(onMissingClasses, - MatchType.PRESENT, context); + List present = getMatchingClasses(onMissingClasses, MatchType.PRESENT, + context); if (!present.isEmpty()) { return ConditionOutcome .noMatch("required @ConditionalOnMissing classes found: " diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java index dd677fd502e..09c302bfda2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java @@ -39,8 +39,9 @@ class OnExpressionCondition extends SpringBootCondition { public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - String expression = (String) metadata.getAnnotationAttributes( - ConditionalOnExpression.class.getName()).get("value"); + String expression = (String) metadata + .getAnnotationAttributes(ConditionalOnExpression.class.getName()) + .get("value"); String rawExpression = expression; if (!expression.startsWith("#{")) { // For convenience allow user to provide bare expression with no #{} wrapper @@ -51,8 +52,8 @@ class OnExpressionCondition extends SpringBootCondition { expression = context.getEnvironment().resolvePlaceholders(expression); ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); BeanExpressionResolver resolver = beanFactory.getBeanExpressionResolver(); - BeanExpressionContext expressionContext = (beanFactory != null) ? new BeanExpressionContext( - beanFactory, null) : null; + BeanExpressionContext expressionContext = (beanFactory != null) + ? new BeanExpressionContext(beanFactory, null) : null; if (resolver == null) { resolver = new StandardBeanExpressionResolver(); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java index df2d7f5ce88..fc65d7b8fb8 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java @@ -55,9 +55,10 @@ class OnJavaCondition extends SpringBootCondition { return new ConditionOutcome(match, getMessage(range, runningVersion, version)); } - private String getMessage(Range range, JavaVersion runningVersion, JavaVersion version) { - String expected = String.format(range == Range.EQUAL_OR_NEWER ? "%s or newer" - : "older than %s", version); + private String getMessage(Range range, JavaVersion runningVersion, + JavaVersion version) { + String expected = String.format( + range == Range.EQUAL_OR_NEWER ? "%s or newer" : "older than %s", version); return "Required JVM version " + expected + " found " + runningVersion; } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java index 2363c3a84d2..954f7fe1daf 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java @@ -41,8 +41,8 @@ class OnJndiCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(ConditionalOnJndi.class.getName())); + AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap( + metadata.getAnnotationAttributes(ConditionalOnJndi.class.getName())); String[] locations = annotationAttributes.getStringArray("value"); try { return getMatchOutcome(locations); @@ -62,9 +62,9 @@ class OnJndiCondition extends SpringBootCondition { JndiLocator locator = getJndiLocator(locations); String location = locator.lookupFirstLocation(); if (location != null) { - return ConditionOutcome.match("JNDI location '" + location - + "' found from candidates " - + StringUtils.arrayToCommaDelimitedString(locations)); + return ConditionOutcome + .match("JNDI location '" + location + "' found from candidates " + + StringUtils.arrayToCommaDelimitedString(locations)); } return ConditionOutcome.noMatch("No JNDI location found from candidates " + StringUtils.arrayToCommaDelimitedString(locations)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java index fadec7e5691..370eca2080d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java @@ -44,8 +44,8 @@ class OnPropertyCondition extends SpringBootCondition { public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(ConditionalOnProperty.class.getName())); + AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap( + metadata.getAnnotationAttributes(ConditionalOnProperty.class.getName())); String prefix = annotationAttributes.getString("prefix").trim(); if (StringUtils.hasText(prefix) && !prefix.endsWith(".")) { 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 62f3f97011f..f4db37ac81b 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 @@ -40,11 +40,11 @@ class OnResourceCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - MultiValueMap attributes = metadata.getAllAnnotationAttributes( - ConditionalOnResource.class.getName(), true); + MultiValueMap attributes = metadata + .getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true); if (attributes != null) { - ResourceLoader loader = context.getResourceLoader() == null ? this.defaultResourceLoader - : context.getResourceLoader(); + ResourceLoader loader = context.getResourceLoader() == null + ? this.defaultResourceLoader : context.getResourceLoader(); List locations = new ArrayList(); collectValues(locations, attributes.get("resources")); Assert.isTrue(locations.size() > 0, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java index aa1dcb3e877..a1313be874f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java @@ -39,7 +39,8 @@ public abstract class SpringBootCondition implements Condition { private final Log logger = LogFactory.getLog(getClass()); @Override - public final boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { + public final boolean matches(ConditionContext context, + AnnotatedTypeMetadata metadata) { String classOrMethodName = getClassOrMethodName(metadata); try { ConditionOutcome outcome = getMatchOutcome(context, metadata); @@ -55,8 +56,8 @@ public abstract class SpringBootCondition implements Condition { + "in the default package by mistake)", ex); } catch (RuntimeException ex) { - throw new IllegalStateException("Error processing condition on " - + getName(metadata), ex); + throw new IllegalStateException( + "Error processing condition on " + getName(metadata), ex); } } @@ -88,7 +89,8 @@ public abstract class SpringBootCondition implements Condition { } } - private StringBuilder getLogMessage(String classOrMethodName, ConditionOutcome outcome) { + private StringBuilder getLogMessage(String classOrMethodName, + ConditionOutcome outcome) { StringBuilder message = new StringBuilder(); message.append("Condition "); message.append(ClassUtils.getShortName(getClass())); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/AbstractRepositoryConfigurationSourceSupport.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/AbstractRepositoryConfigurationSourceSupport.java index fcf70cb6068..d0118307346 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/AbstractRepositoryConfigurationSourceSupport.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/AbstractRepositoryConfigurationSourceSupport.java @@ -42,8 +42,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi * @author Dave Syer * @author Oliver Gierke */ -public abstract class AbstractRepositoryConfigurationSourceSupport implements - BeanFactoryAware, ImportBeanDefinitionRegistrar, ResourceLoaderAware, +public abstract class AbstractRepositoryConfigurationSourceSupport + implements BeanFactoryAware, ImportBeanDefinitionRegistrar, ResourceLoaderAware, EnvironmentAware { private ResourceLoader resourceLoader; @@ -55,9 +55,9 @@ public abstract class AbstractRepositoryConfigurationSourceSupport implements @Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { - new RepositoryConfigurationDelegate(getConfigurationSource(), - this.resourceLoader, this.environment).registerRepositoriesIn(registry, - getRepositoryConfigurationExtension()); + new RepositoryConfigurationDelegate(getConfigurationSource(), this.resourceLoader, + this.environment).registerRepositoriesIn(registry, + getRepositoryConfigurationExtension()); } private AnnotationRepositoryConfigurationSource getConfigurationSource() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesRegistrar.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesRegistrar.java index 3102f019883..1cbacce711e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesRegistrar.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesRegistrar.java @@ -32,8 +32,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi * @author Mohsin Husen * @since 1.1.0 */ -class ElasticsearchRepositoriesRegistrar extends - AbstractRepositoryConfigurationSourceSupport { +class ElasticsearchRepositoriesRegistrar + extends AbstractRepositoryConfigurationSourceSupport { @Override protected Class getAnnotation() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigureRegistrar.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigureRegistrar.java index c853a3b4513..c95daf527a9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigureRegistrar.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigureRegistrar.java @@ -31,8 +31,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi * @author Phillip Webb * @author Dave Syer */ -class JpaRepositoriesAutoConfigureRegistrar extends - AbstractRepositoryConfigurationSourceSupport { +class JpaRepositoriesAutoConfigureRegistrar + extends AbstractRepositoryConfigurationSourceSupport { @Override protected Class getAnnotation() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.java index dcb97c0b544..de19ca82b2b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.java @@ -125,8 +125,8 @@ public class MongoDataAutoConfiguration implements BeanClassLoaderAware { MappingMongoConverter mappingConverter = new MappingMongoConverter(dbRefResolver, context); try { - mappingConverter.setCustomConversions(beanFactory - .getBean(CustomConversions.class)); + mappingConverter + .setCustomConversions(beanFactory.getBean(CustomConversions.class)); } catch (NoSuchBeanDefinitionException ex) { // Ignore @@ -183,8 +183,9 @@ public class MongoDataAutoConfiguration implements BeanClassLoaderAware { @ConditionalOnMissingBean public GridFsTemplate gridFsTemplate(MongoDbFactory mongoDbFactory, MongoTemplate mongoTemplate) { - return new GridFsTemplate(new GridFsMongoDbFactory(mongoDbFactory, - this.properties), mongoTemplate.getConverter()); + return new GridFsTemplate( + new GridFsMongoDbFactory(mongoDbFactory, this.properties), + mongoTemplate.getConverter()); } /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigureRegistrar.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigureRegistrar.java index feae1ecb95f..16d44ccba2b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigureRegistrar.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigureRegistrar.java @@ -30,8 +30,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi * * @author Dave Syer */ -class MongoRepositoriesAutoConfigureRegistrar extends - AbstractRepositoryConfigurationSourceSupport { +class MongoRepositoriesAutoConfigureRegistrar + extends AbstractRepositoryConfigurationSourceSupport { @Override protected Class getAnnotation() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java index 4251fd50d34..fe160209279 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java @@ -83,8 +83,9 @@ public class FlywayAutoConfiguration { Assert.state(!this.properties.getLocations().isEmpty(), "Migration script locations not configured"); boolean exists = hasAtLeastOneLocation(); - Assert.state(exists, "Cannot find migrations location in: " - + this.properties.getLocations() + Assert.state(exists, + "Cannot find migrations location in: " + this.properties + .getLocations() + " (please add migrations or check your Flyway configuration)"); } } @@ -104,8 +105,8 @@ public class FlywayAutoConfiguration { Flyway flyway = new Flyway(); if (this.properties.isCreateDataSource()) { flyway.setDataSource(this.properties.getUrl(), this.properties.getUser(), - this.properties.getPassword(), this.properties.getInitSqls() - .toArray(new String[0])); + this.properties.getPassword(), + this.properties.getInitSqls().toArray(new String[0])); } else if (this.flywayDataSource != null) { flyway.setDataSource(this.flywayDataSource); @@ -147,8 +148,8 @@ public class FlywayAutoConfiguration { @Configuration @ConditionalOnClass(LocalContainerEntityManagerFactoryBean.class) @ConditionalOnBean(AbstractEntityManagerFactoryBean.class) - protected static class FlywayJpaDependencyConfiguration extends - EntityManagerFactoryDependsOnPostProcessor { + protected static class FlywayJpaDependencyConfiguration + extends EntityManagerFactoryDependsOnPostProcessor { public FlywayJpaDependencyConfiguration() { super("flyway"); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java index 3dacacac661..2c38d40a98c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java @@ -29,8 +29,8 @@ import org.springframework.util.ClassUtils; * @author Andy Wilkinson * @since 1.1.0 */ -public class FreeMarkerTemplateAvailabilityProvider implements - TemplateAvailabilityProvider { +public class FreeMarkerTemplateAvailabilityProvider + implements TemplateAvailabilityProvider { @Override public boolean isTemplateAvailable(String view, Environment environment, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java index 42bc3329315..6a86b646f8e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java @@ -52,12 +52,13 @@ public class GroovyTemplateResolver implements TemplateResolver { public URL resolveTemplate(final String templatePath) throws IOException { MarkupTemplateEngine.TemplateResource templateResource = MarkupTemplateEngine.TemplateResource .parse(templatePath); - URL resource = this.templateClassLoader.getResource(templateResource.withLocale( - LocaleContextHolder.getLocale().toString().replace("-", "_")).toString()); + URL resource = this.templateClassLoader.getResource(templateResource + .withLocale(LocaleContextHolder.getLocale().toString().replace("-", "_")) + .toString()); if (resource == null) { // no resource found with the default locale, try without any locale - resource = this.templateClassLoader.getResource(templateResource.withLocale( - null).toString()); + resource = this.templateClassLoader + .getResource(templateResource.withLocale(null).toString()); } if (resource == null) { throw new IOException("Unable to load template:" + templatePath); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java index afb8db3b1fd..7cbbbd8c456 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java @@ -88,8 +88,8 @@ public class HypermediaAutoConfiguration { * {@link BeanPostProcessor} to apply any {@link Jackson2ObjectMapperBuilder} * configuration to the HAL {@link ObjectMapper}. */ - private static class HalObjectMapperConfigurer implements BeanPostProcessor, - BeanFactoryAware { + private static class HalObjectMapperConfigurer + implements BeanPostProcessor, BeanFactoryAware { private BeanFactory beanFactory; 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 c4077a1435c..2a72e5f9a64 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 @@ -78,8 +78,8 @@ public class DataSourceAutoConfiguration { ConfigurableListableBeanFactory beanFactory) { try { BeanDefinition beanDefinition = beanFactory.getBeanDefinition("dataSource"); - return EmbeddedDataSourceConfiguration.class.getName().equals( - beanDefinition.getFactoryBeanName()); + return EmbeddedDataSourceConfiguration.class.getName() + .equals(beanDefinition.getFactoryBeanName()); } catch (NoSuchBeanDefinitionException ex) { return false; @@ -117,8 +117,7 @@ public class DataSourceAutoConfiguration { DataSourceBuilder factory = DataSourceBuilder .create(this.properties.getClassLoader()) .driverClassName(this.properties.getDriverClassName()) - .url(this.properties.getUrl()) - .username(this.properties.getUsername()) + .url(this.properties.getUrl()).username(this.properties.getUsername()) .password(this.properties.getPassword()); if (this.properties.getType() != null) { factory.type(this.properties.getType()); @@ -212,8 +211,8 @@ public class DataSourceAutoConfiguration { return ConditionOutcome .noMatch("existing non-embedded database detected"); } - EmbeddedDatabaseType type = EmbeddedDatabaseConnection.get( - context.getClassLoader()).getType(); + EmbeddedDatabaseType type = EmbeddedDatabaseConnection + .get(context.getClassLoader()).getType(); if (type == null) { return ConditionOutcome.noMatch("no embedded database detected"); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java index e5d92d331bf..51e5a713dec 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java @@ -63,7 +63,8 @@ class DataSourceInitializer implements ApplicationListener 0) { + if (this.applicationContext.getBeanNamesForType(DataSource.class, false, + false).length > 0) { this.dataSource = this.applicationContext.getBean(DataSource.class); } if (this.dataSource == null) { @@ -78,8 +79,8 @@ class DataSourceInitializer implements ApplicationListener DRIVERS; + static { Map drivers = new HashMap(); drivers.put("derby", "org.apache.derby.jdbc.EmbeddedDriver"); @@ -59,8 +60,8 @@ class DriverClassNameProvider { */ String getDriverClassName(final String jdbcUrl) { Assert.notNull(jdbcUrl, "JdbcUrl must not be null"); - Assert.isTrue(jdbcUrl.startsWith(JDBC_URL_PREFIX), "JdbcUrl must start with '" - + JDBC_URL_PREFIX + "'"); + Assert.isTrue(jdbcUrl.startsWith(JDBC_URL_PREFIX), + "JdbcUrl must start with '" + JDBC_URL_PREFIX + "'"); String urlWithoutPrefix = jdbcUrl.substring(JDBC_URL_PREFIX.length()); for (Map.Entry driver : DRIVERS.entrySet()) { if (urlWithoutPrefix.startsWith(":" + driver.getKey() + ":")) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java index 93f78e3f3f0..685fac7ecda 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java @@ -107,10 +107,9 @@ public enum EmbeddedDatabaseConnection { * @return true if the driver class is one of the embedded types */ public static boolean isEmbedded(String driverClass) { - return driverClass != null - && (driverClass.equals(HSQL.driverClass) - || driverClass.equals(H2.driverClass) || driverClass - .equals(DERBY.driverClass)); + return driverClass != null && (driverClass.equals(HSQL.driverClass) + || driverClass.equals(H2.driverClass) + || driverClass.equals(DERBY.driverClass)); } /** @@ -141,8 +140,8 @@ public enum EmbeddedDatabaseConnection { return override; } for (EmbeddedDatabaseConnection candidate : EmbeddedDatabaseConnection.values()) { - if (candidate != NONE - && ClassUtils.isPresent(candidate.getDriverClassName(), classLoader)) { + if (candidate != NONE && ClassUtils.isPresent(candidate.getDriverClassName(), + classLoader)) { return candidate; } } @@ -155,8 +154,8 @@ public enum EmbeddedDatabaseConnection { private static class IsEmbedded implements ConnectionCallback { @Override - public Boolean doInConnection(Connection connection) throws SQLException, - DataAccessException { + public Boolean doInConnection(Connection connection) + throws SQLException, DataAccessException { String productName = connection.getMetaData().getDatabaseProductName(); if (productName == null) { return false; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadata.java index a98a8664d87..38c113efc2e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadata.java @@ -25,8 +25,8 @@ import javax.sql.DataSource; * @author Stephane Nicoll * @since 1.2.0 */ -public abstract class AbstractDataSourcePoolMetadata implements - DataSourcePoolMetadata { +public abstract class AbstractDataSourcePoolMetadata + implements DataSourcePoolMetadata { private final T dataSource; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java index b1ed90370ab..064a824652d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java @@ -26,8 +26,8 @@ import org.apache.commons.dbcp.BasicDataSource; * @author Stephane Nicoll * @since 1.2.0 */ -public class CommonsDbcpDataSourcePoolMetadata extends - AbstractDataSourcePoolMetadata { +public class CommonsDbcpDataSourcePoolMetadata + extends AbstractDataSourcePoolMetadata { public CommonsDbcpDataSourcePoolMetadata(BasicDataSource dataSource) { super(dataSource); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadata.java index 30f6d6dbae2..6ebe304caaa 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadata.java @@ -33,7 +33,8 @@ public interface DataSourcePoolMetadata { *
      *
    • 1 means that the maximum number of connections have been allocated
    • *
    • 0 means that no connection is currently active
    • - *
    • -1 means there is not limit to the number of connections that can be allocated
    • + *
    • -1 means there is not limit to the number of connections that can be allocated + *
    • *
    * This may also return {@code null} if the data source does not provide the necessary * information to compute the poll usage. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadata.java index c656249d4ad..46e467f1f94 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadata.java @@ -29,8 +29,8 @@ import com.zaxxer.hikari.pool.HikariPool; * @author Stephane Nicoll * @since 1.2.0 */ -public class HikariDataSourcePoolMetadata extends - AbstractDataSourcePoolMetadata { +public class HikariDataSourcePoolMetadata + extends AbstractDataSourcePoolMetadata { public HikariDataSourcePoolMetadata(HikariDataSource dataSource) { super(dataSource); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadata.java index 5dcc6b4ab61..e0e0e031d1f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadata.java @@ -24,8 +24,8 @@ import org.apache.tomcat.jdbc.pool.DataSource; * * @author Stephane Nicoll */ -public class TomcatDataSourcePoolMetadata extends - AbstractDataSourcePoolMetadata { +public class TomcatDataSourcePoolMetadata + extends AbstractDataSourcePoolMetadata { public TomcatDataSourcePoolMetadata(DataSource dataSource) { super(dataSource); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java index 8a3f5a7d396..32ec0b137dc 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java @@ -57,8 +57,7 @@ import org.springframework.web.filter.RequestContextFilter; * @author Andy Wilkinson */ @Configuration -@ConditionalOnClass(name = { - "org.glassfish.jersey.server.spring.SpringComponentProvider", +@ConditionalOnClass(name = { "org.glassfish.jersey.server.spring.SpringComponentProvider", "javax.servlet.ServletRegistration" }) @ConditionalOnBean(type = "org.glassfish.jersey.server.ResourceConfig") @ConditionalOnWebApplication diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java index 6067b4627dd..de4640eb2a1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java @@ -53,7 +53,8 @@ import org.springframework.util.StringUtils; public class JndiConnectionFactoryAutoConfiguration { // Keep these in sync with the condition below - private static String[] JNDI_LOCATIONS = { "java:/JmsXA", "java:/XAConnectionFactory" }; + private static String[] JNDI_LOCATIONS = { "java:/JmsXA", + "java:/XAConnectionFactory" }; @Autowired private JmsProperties properties; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java index 4dd947349c0..f90501f56d1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java @@ -46,8 +46,8 @@ class ActiveMQConnectionFactoryFactory { return doCreateConnectionFactory(factoryClass); } catch (Exception ex) { - throw new IllegalStateException("Unable to create " - + "ActiveMQConnectionFactory", ex); + throw new IllegalStateException( + "Unable to create " + "ActiveMQConnectionFactory", ex); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQConnectionFactoryFactory.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQConnectionFactoryFactory.java index d76587c527f..9ec3e4573a5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQConnectionFactoryFactory.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQConnectionFactoryFactory.java @@ -62,8 +62,8 @@ class HornetQConnectionFactoryFactory { return doCreateConnectionFactory(factoryClass); } catch (Exception ex) { - throw new IllegalStateException("Unable to create " - + "HornetQConnectionFactory", ex); + throw new IllegalStateException( + "Unable to create " + "HornetQConnectionFactory", ex); } } @@ -106,12 +106,12 @@ class HornetQConnectionFactoryFactory { Class factoryClass) throws Exception { try { TransportConfiguration transportConfiguration = new TransportConfiguration( - InVMConnectorFactory.class.getName(), this.properties.getEmbedded() - .generateTransportParameters()); + InVMConnectorFactory.class.getName(), + this.properties.getEmbedded().generateTransportParameters()); ServerLocator serviceLocator = HornetQClient .createServerLocatorWithoutHA(transportConfiguration); - return factoryClass.getConstructor(ServerLocator.class).newInstance( - serviceLocator); + return factoryClass.getConstructor(ServerLocator.class) + .newInstance(serviceLocator); } catch (NoClassDefFoundError ex) { throw new IllegalStateException("Unable to create InVM " diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQEmbeddedServerConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQEmbeddedServerConfiguration.java index 2a82e9b1dfd..e79c54605a1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQEmbeddedServerConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQEmbeddedServerConfiguration.java @@ -106,16 +106,15 @@ class HornetQEmbeddedServerConfiguration { private void addQueues(JMSConfiguration configuration, String[] queues) { boolean persistent = this.properties.getEmbedded().isPersistent(); for (String queue : queues) { - configuration.getQueueConfigurations().add( - new JMSQueueConfigurationImpl(queue, null, persistent, "/queue/" - + queue)); + configuration.getQueueConfigurations().add(new JMSQueueConfigurationImpl( + queue, null, persistent, "/queue/" + queue)); } } private void addTopics(JMSConfiguration configuration, String[] topics) { for (String topic : topics) { - configuration.getTopicConfigurations().add( - new TopicConfigurationImpl(topic, "/topic/" + topic)); + configuration.getTopicConfigurations() + .add(new TopicConfigurationImpl(topic, "/topic/" + topic)); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQXAConnectionFactoryConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQXAConnectionFactoryConfiguration.java index f9aa8608c0c..74b71d72c01 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQXAConnectionFactoryConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQXAConnectionFactoryConfiguration.java @@ -46,10 +46,10 @@ class HornetQXAConnectionFactoryConfiguration { @Bean(name = { "jmsConnectionFactory", "xaJmsConnectionFactory" }) public ConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory, HornetQProperties properties, XAConnectionFactoryWrapper wrapper) - throws Exception { - return wrapper.wrapConnectionFactory(new HornetQConnectionFactoryFactory( - beanFactory, properties) - .createConnectionFactory(HornetQXAConnectionFactory.class)); + throws Exception { + return wrapper.wrapConnectionFactory( + new HornetQConnectionFactoryFactory(beanFactory, properties) + .createConnectionFactory(HornetQXAConnectionFactory.class)); } @Bean diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java index 5c6c5069bb1..2dcee997373 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java @@ -36,8 +36,8 @@ import org.springframework.util.ObjectUtils; * @author Dave Syer * @since 1.1.1 */ -public class ParentAwareNamingStrategy extends MetadataNamingStrategy implements - ApplicationContextAware { +public class ParentAwareNamingStrategy extends MetadataNamingStrategy + implements ApplicationContextAware { private ApplicationContext applicationContext; @@ -51,7 +51,8 @@ public class ParentAwareNamingStrategy extends MetadataNamingStrategy implements * Set if unique runtime object names should be ensured. * @param ensureUniqueRuntimeObjectNames {@code true} if unique names should ensured. */ - public void setEnsureUniqueRuntimeObjectNames(boolean ensureUniqueRuntimeObjectNames) { + public void setEnsureUniqueRuntimeObjectNames( + boolean ensureUniqueRuntimeObjectNames) { this.ensureUniqueRuntimeObjectNames = ensureUniqueRuntimeObjectNames; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java index 6457e7f1c61..9257585da57 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java @@ -80,15 +80,16 @@ public class LiquibaseAutoConfiguration { @PostConstruct public void checkChangelogExists() { if (this.properties.isCheckChangeLogLocation()) { - Resource resource = this.resourceLoader.getResource(this.properties - .getChangeLog()); - Assert.state(resource.exists(), "Cannot find changelog location: " - + resource + " (please add changelog or check your Liquibase " - + "configuration)"); + Resource resource = this.resourceLoader + .getResource(this.properties.getChangeLog()); + Assert.state(resource.exists(), + "Cannot find changelog location: " + resource + + " (please add changelog or check your Liquibase " + + "configuration)"); } ServiceLocator serviceLocator = ServiceLocator.getInstance(); - serviceLocator.addPackageToScan(CommonsLoggingLiquibaseLogger.class - .getPackage().getName()); + serviceLocator.addPackageToScan( + CommonsLoggingLiquibaseLogger.class.getPackage().getName()); } @Bean @@ -122,8 +123,8 @@ public class LiquibaseAutoConfiguration { @Configuration @ConditionalOnClass(LocalContainerEntityManagerFactoryBean.class) @ConditionalOnBean(AbstractEntityManagerFactoryBean.class) - protected static class LiquibaseJpaDependencyConfiguration extends - EntityManagerFactoryDependsOnPostProcessor { + protected static class LiquibaseJpaDependencyConfiguration + extends EntityManagerFactoryDependsOnPostProcessor { public LiquibaseJpaDependencyConfiguration() { super("liquibase"); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java index e7ad4dbf19f..a623862b911 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java @@ -116,8 +116,8 @@ public class DeviceDelegatingViewResolverAutoConfiguration { @EnableConfigurationProperties(DeviceDelegatingViewResolverProperties.class) @ConditionalOnMissingBean(name = "thymeleafViewResolver") @ConditionalOnBean(InternalResourceViewResolver.class) - protected static class InternalResourceViewResolverDelegateConfiguration extends - AbstractDelegateConfiguration { + protected static class InternalResourceViewResolverDelegateConfiguration + extends AbstractDelegateConfiguration { @Autowired private InternalResourceViewResolver viewResolver; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java index b51132a9c17..5d41a1a433c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java @@ -48,7 +48,8 @@ public class DeviceResolverAutoConfiguration { @Configuration @ConditionalOnWebApplication - protected static class DeviceResolverMvcConfiguration extends WebMvcConfigurerAdapter { + protected static class DeviceResolverMvcConfiguration + extends WebMvcConfigurerAdapter { @Autowired private DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java index 33f98ad3bf8..9d307082b36 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java @@ -52,7 +52,8 @@ public class SitePreferenceAutoConfiguration { @Configuration @ConditionalOnWebApplication - protected static class SitePreferenceMvcConfiguration extends WebMvcConfigurerAdapter { + protected static class SitePreferenceMvcConfiguration + extends WebMvcConfigurerAdapter { @Autowired private SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java index 2d1c1b6eb2e..7c4fb639487 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java @@ -215,8 +215,8 @@ public class MongoProperties { } List credentials = null; if (hasCustomCredentials()) { - String database = this.authenticationDatabase == null ? getMongoClientDatabase() - : this.authenticationDatabase; + String database = this.authenticationDatabase == null + ? getMongoClientDatabase() : this.authenticationDatabase; credentials = Arrays.asList(MongoCredential.createMongoCRCredential( this.username, database, this.password)); } @@ -274,8 +274,8 @@ public class MongoProperties { builder.socketFactory(options.getSocketFactory()); builder.socketKeepAlive(options.isSocketKeepAlive()); builder.socketTimeout(options.getSocketTimeout()); - builder.threadsAllowedToBlockForConnectionMultiplier(options - .getThreadsAllowedToBlockForConnectionMultiplier()); + builder.threadsAllowedToBlockForConnectionMultiplier( + options.getThreadsAllowedToBlockForConnectionMultiplier()); builder.writeConcern(options.getWriteConcern()); } return builder; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java index e2dadb570c3..44b0cdcf46c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java @@ -36,8 +36,8 @@ import com.samskivert.mustache.Mustache.VariableFetcher; * @author Dave Syer * @since 1.2.2 */ -public class MustacheEnvironmentCollector extends DefaultCollector implements - EnvironmentAware { +public class MustacheEnvironmentCollector extends DefaultCollector + implements EnvironmentAware { private ConfigurableEnvironment environment; @@ -51,8 +51,8 @@ public class MustacheEnvironmentCollector extends DefaultCollector implements public void setEnvironment(Environment environment) { this.environment = (ConfigurableEnvironment) environment; this.target = new HashMap(); - new RelaxedDataBinder(this.target).bind(new PropertySourcesPropertyValues( - this.environment.getPropertySources())); + new RelaxedDataBinder(this.target).bind( + new PropertySourcesPropertyValues(this.environment.getPropertySources())); this.propertyResolver = new RelaxedPropertyResolver(environment); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java index 79858b38259..51cde07ee6c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java @@ -38,8 +38,8 @@ import com.samskivert.mustache.Mustache.TemplateLoader; * @see Mustache * @see Resource */ -public class MustacheResourceTemplateLoader implements TemplateLoader, - ResourceLoaderAware { +public class MustacheResourceTemplateLoader + implements TemplateLoader, ResourceLoaderAware { private String prefix = ""; @@ -77,8 +77,9 @@ public class MustacheResourceTemplateLoader implements TemplateLoader, @Override public Reader getTemplate(String name) throws Exception { - return new InputStreamReader(this.resourceLoader.getResource( - this.prefix + name + this.suffix).getInputStream(), this.charSet); + return new InputStreamReader(this.resourceLoader + .getResource(this.prefix + name + this.suffix).getInputStream(), + this.charSet); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheTemplateAvailabilityProvider.java index 72548a8d284..24548788636 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheTemplateAvailabilityProvider.java @@ -30,7 +30,8 @@ import org.springframework.util.ClassUtils; * @author Dave Syer * @since 1.2.2 */ -public class MustacheTemplateAvailabilityProvider implements TemplateAvailabilityProvider { +public class MustacheTemplateAvailabilityProvider + implements TemplateAvailabilityProvider { @Override public boolean isTemplateAvailable(String view, Environment environment, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewResolver.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewResolver.java index a04dc52d619..f7e5706c61e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewResolver.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewResolver.java @@ -86,8 +86,8 @@ public class MustacheViewResolver extends UrlBasedViewResolver { } private Resource resolveFromLocale(String viewName, String locale) { - Resource resource = getApplicationContext().getResource( - getPrefix() + viewName + locale + getSuffix()); + Resource resource = getApplicationContext() + .getResource(getPrefix() + viewName + locale + getSuffix()); if (resource == null || !resource.exists()) { if (locale.isEmpty()) { return null; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java index 3db3f0a1f0f..f8768a92627 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java @@ -66,8 +66,8 @@ class DataSourceInitializedPublisher implements BeanPostProcessor { } if (bean instanceof EntityManagerFactory && this.dataSource != null && isInitializingDatabase()) { - this.applicationContext.publishEvent(new DataSourceInitializedEvent( - this.dataSource)); + this.applicationContext + .publishEvent(new DataSourceInitializedEvent(this.dataSource)); } return bean; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java index 6ab9be079a2..dc120a931ea 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java @@ -127,8 +127,9 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration { } private boolean runningOnWebSphere() { - return ClassUtils.isPresent("com.ibm.websphere.jtaextensions." - + "ExtendedJTATransaction", getClass().getClassLoader()); + return ClassUtils.isPresent( + "com.ibm.websphere.jtaextensions." + "ExtendedJTATransaction", + getClass().getClassLoader()); } private void configureWebSphereTransactionPlatform( @@ -143,8 +144,8 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration { private void configureSpringJtaPlatform(Map vendorProperties, JtaTransactionManager jtaTransactionManager) { try { - vendorProperties.put(JTA_PLATFORM, new SpringJtaPlatform( - jtaTransactionManager)); + vendorProperties.put(JTA_PLATFORM, + new SpringJtaPlatform(jtaTransactionManager)); } catch (LinkageError ex) { // NoClassDefFoundError can happen if Hibernate 4.2 is used and some diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java index a082c518626..da78c88601c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java @@ -78,7 +78,8 @@ public class AuthenticationManagerConfiguration { @Bean public static SpringBootAuthenticationConfigurerAdapter springBootAuthenticationConfigurerAdapter( - SecurityProperties securityProperties, List dependencies) { + SecurityProperties securityProperties, + List dependencies) { return new SpringBootAuthenticationConfigurerAdapter(securityProperties); } @@ -102,12 +103,13 @@ public class AuthenticationManagerConfiguration { * {@link AuthenticationManagerBuilder#authenticationProvider(AuthenticationProvider)} * method since all other methods add a {@link SecurityConfigurer} which is not * allowed in the configure stage. It is not allowed because we guarantee all init - * methods are invoked before configure, which cannot be guaranteed at this point. + * methods are invoked before configure, which cannot be guaranteed at this point. + * *
*/ @Order(Ordered.LOWEST_PRECEDENCE - 100) - private static class SpringBootAuthenticationConfigurerAdapter extends - GlobalAuthenticationConfigurerAdapter { + private static class SpringBootAuthenticationConfigurerAdapter + extends GlobalAuthenticationConfigurerAdapter { private final SecurityProperties securityProperties; @@ -145,8 +147,8 @@ public class AuthenticationManagerConfiguration { * {@link DefaultInMemoryUserDetailsManagerConfigurer} will default the value. * */ - private static class DefaultInMemoryUserDetailsManagerConfigurer extends - InMemoryUserDetailsManagerConfigurer { + private static class DefaultInMemoryUserDetailsManagerConfigurer + extends InMemoryUserDetailsManagerConfigurer { private final SecurityProperties securityProperties; @@ -165,8 +167,8 @@ public class AuthenticationManagerConfiguration { + "\n"); } Set roles = new LinkedHashSet(user.getRole()); - withUser(user.getName()).password(user.getPassword()).roles( - roles.toArray(new String[roles.size()])); + withUser(user.getName()).password(user.getPassword()) + .roles(roles.toArray(new String[roles.size()])); setField(auth, "defaultUserDetailsService", getUserDetailsService()); super.configure(auth); } @@ -189,8 +191,8 @@ public class AuthenticationManagerConfiguration { * into the {@link AuthenticationManager}. */ @Component - protected static class AuthenticationManagerConfigurationListener implements - SmartInitializingSingleton { + protected static class AuthenticationManagerConfigurationListener + implements SmartInitializingSingleton { @Autowired private AuthenticationEventPublisher eventPublisher; @@ -201,8 +203,8 @@ public class AuthenticationManagerConfiguration { @Override public void afterSingletonsInstantiated() { try { - configureAuthenticationManager(this.context - .getBean(AuthenticationManager.class)); + configureAuthenticationManager( + this.context.getBean(AuthenticationManager.class)); } catch (NoSuchBeanDefinitionException ex) { // Ignore diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/BootGlobalAuthenticationConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/BootGlobalAuthenticationConfiguration.java index 962591a408d..22d973b1ff0 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/BootGlobalAuthenticationConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/BootGlobalAuthenticationConfiguration.java @@ -56,8 +56,8 @@ public class BootGlobalAuthenticationConfiguration { return new BootGlobalAuthenticationConfigurationAdapter(context); } - private static class BootGlobalAuthenticationConfigurationAdapter extends - GlobalAuthenticationConfigurerAdapter { + private static class BootGlobalAuthenticationConfigurationAdapter + extends GlobalAuthenticationConfigurerAdapter { private static Log logger = LogFactory .getLog(BootGlobalAuthenticationConfiguration.class); 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 8f21bc9d8ab..3da4911a261 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,7 +40,8 @@ public class SecurityProperties implements SecurityPrerequisite { * useful place to put user-defined access rules if you want to override the default * access rules. */ - public static final int ACCESS_OVERRIDE_ORDER = SecurityProperties.BASIC_AUTH_ORDER - 2; + public static final int ACCESS_OVERRIDE_ORDER = SecurityProperties.BASIC_AUTH_ORDER + - 2; /** * Order applied to the WebSecurityConfigurerAdapter that is used to configure basic diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java index 57d95f7a300..f9d2d2d57d3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java @@ -128,8 +128,8 @@ public class SpringBootWebSecurityConfiguration { // Get the ignored paths in early @Order(SecurityProperties.IGNORED_ORDER) - private static class IgnoredPathsWebSecurityConfigurerAdapter implements - WebSecurityConfigurer { + private static class IgnoredPathsWebSecurityConfigurerAdapter + implements WebSecurityConfigurer { @Autowired(required = false) private ErrorController errorController; @@ -168,8 +168,8 @@ public class SpringBootWebSecurityConfiguration { @Configuration @ConditionalOnProperty(prefix = "security.basic", name = "enabled", havingValue = "false") @Order(SecurityProperties.BASIC_AUTH_ORDER) - protected static class ApplicationNoWebSecurityConfigurerAdapter extends - WebSecurityConfigurerAdapter { + protected static class ApplicationNoWebSecurityConfigurerAdapter + extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.requestMatcher(new RequestMatcher() { @@ -184,8 +184,8 @@ public class SpringBootWebSecurityConfiguration { @Configuration @ConditionalOnProperty(prefix = "security.basic", name = "enabled", matchIfMissing = true) @Order(SecurityProperties.BASIC_AUTH_ORDER) - protected static class ApplicationWebSecurityConfigurerAdapter extends - WebSecurityConfigurerAdapter { + protected static class ApplicationWebSecurityConfigurerAdapter + extends WebSecurityConfigurerAdapter { @Autowired private SecurityProperties security; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java index b9f5088e441..332f1f9a6cd 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java @@ -70,7 +70,8 @@ public class SocialWebAutoConfiguration { @Configuration @EnableSocial @ConditionalOnWebApplication - protected static class SocialAutoConfigurationAdapter extends SocialConfigurerAdapter { + protected static class SocialAutoConfigurationAdapter + extends SocialConfigurerAdapter { @Autowired(required = false) private List> connectInterceptors; @@ -84,7 +85,8 @@ public class SocialWebAutoConfiguration { @Bean @ConditionalOnMissingBean(ConnectController.class) public ConnectController connectController( - ConnectionFactoryLocator factoryLocator, ConnectionRepository repository) { + ConnectionFactoryLocator factoryLocator, + ConnectionRepository repository) { ConnectController controller = new ConnectController(factoryLocator, repository); if (!CollectionUtils.isEmpty(this.connectInterceptors)) { @@ -142,8 +144,8 @@ public class SocialWebAutoConfiguration { @EnableSocial @ConditionalOnWebApplication @ConditionalOnClass(SecurityContextHolder.class) - protected static class AuthenticationUserIdSourceConfig extends - SocialConfigurerAdapter { + protected static class AuthenticationUserIdSourceConfig + extends SocialConfigurerAdapter { @Override public UserIdSource getUserIdSource() { @@ -170,8 +172,8 @@ public class SocialWebAutoConfiguration { public String getUserId() { SecurityContext context = SecurityContextHolder.getContext(); Authentication authentication = context.getAuthentication(); - Assert.state(authentication != null, "Unable to get a " - + "ConnectionRepository: no user signed in"); + Assert.state(authentication != null, + "Unable to get a " + "ConnectionRepository: no user signed in"); return authentication.getName(); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java index 3d0b8ea7f7a..a1bb4ccdde0 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java @@ -28,8 +28,8 @@ import org.springframework.web.servlet.view.AbstractTemplateViewResolver; * @author Andy Wilkinson * @since 1.1.0 */ -public abstract class AbstractTemplateViewResolverProperties extends - AbstractViewResolverProperties { +public abstract class AbstractTemplateViewResolverProperties + extends AbstractViewResolverProperties { /** * Prefix that gets prepended to view names when building a URL. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProvider.java index aff1fe3627e..540cada5304 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProvider.java @@ -30,8 +30,8 @@ import org.springframework.util.ClassUtils; * @author Andy Wilkinson * @since 1.1.0 */ -public class ThymeleafTemplateAvailabilityProvider implements - TemplateAvailabilityProvider { +public class ThymeleafTemplateAvailabilityProvider + implements TemplateAvailabilityProvider { @Override public boolean isTemplateAvailable(String view, Environment environment, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java index db02fb2d0d0..725e476d7d6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java @@ -101,7 +101,8 @@ class BitronixJtaConfiguration { } @Bean - public JtaTransactionManager transactionManager(TransactionManager transactionManager) { + public JtaTransactionManager transactionManager( + TransactionManager transactionManager) { return new JtaTransactionManager(transactionManager); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java index 81fb42916e7..4b22131f185 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java @@ -30,7 +30,8 @@ import org.springframework.util.ClassUtils; * @author Andy Wilkinson * @since 1.1.0 */ -public class VelocityTemplateAvailabilityProvider implements TemplateAvailabilityProvider { +public class VelocityTemplateAvailabilityProvider + implements TemplateAvailabilityProvider { @Override public boolean isTemplateAvailable(String view, Environment environment, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java index c6d3a35ef98..a291bff3807 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java @@ -56,8 +56,8 @@ import org.springframework.web.servlet.ModelAndView; * @see ErrorAttributes */ @Order(Ordered.HIGHEST_PRECEDENCE) -public class DefaultErrorAttributes implements ErrorAttributes, HandlerExceptionResolver, - Ordered { +public class DefaultErrorAttributes + implements ErrorAttributes, HandlerExceptionResolver, Ordered { private static final String ERROR_ATTRIBUTE = DefaultErrorAttributes.class.getName() + ".ERROR"; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java index 27a74dccf1b..205fb2df114 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java @@ -83,7 +83,8 @@ public class EmbeddedServletContainerAutoConfiguration { * Nested configuration if Jetty is being used. */ @Configuration - @ConditionalOnClass({ Servlet.class, Server.class, Loader.class, WebAppContext.class }) + @ConditionalOnClass({ Servlet.class, Server.class, Loader.class, + WebAppContext.class }) @ConditionalOnMissingBean(value = EmbeddedServletContainerFactory.class, search = SearchStrategy.CURRENT) public static class EmbeddedJetty { 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 a2bba1c48de..94d972add6c 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 @@ -52,6 +52,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp public class HttpMessageConverters implements Iterable> { private static final List> NON_REPLACING_CONVERTERS; + static { List> nonReplacingConverters = new ArrayList>(); addClassIfExists(nonReplacingConverters, "org.springframework.hateoas.mvc." @@ -81,7 +82,8 @@ public class HttpMessageConverters implements Iterable> * default converter is found) The {@link #postProcessConverters(List)} method can be * used for further converter manipulation. */ - public HttpMessageConverters(Collection> additionalConverters) { + public HttpMessageConverters( + Collection> additionalConverters) { this(true, additionalConverters); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java index 32cbcfa5031..396beb63b71 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java @@ -30,13 +30,11 @@ import org.springframework.util.StringUtils; * be obtained. *
  • {@literal multipart.maxFileSize} specifies the maximum size permitted for uploaded * files. The default is 1Mb.
  • - *
  • - * {@literal multipart.maxRequestSize} specifies the maximum size allowed for + *
  • {@literal multipart.maxRequestSize} specifies the maximum size allowed for * {@literal multipart/form-data} requests. The default is 10Mb
  • - *
  • - * {@literal multipart.fileSizeThreshold} specifies the size threshold after which files - * will be written to disk. Default is 0, which means that the file will be written to - * disk immediately.
  • + *
  • {@literal multipart.fileSizeThreshold} specifies the size threshold after which + * files will be written to disk. Default is 0, which means that the file will be written + * to disk immediately.
  • * *

    * These properties are ultimately passed through diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/JettyWebSocketContainerCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/JettyWebSocketContainerCustomizer.java index c510f311df5..a10155bd68b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/JettyWebSocketContainerCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/JettyWebSocketContainerCustomizer.java @@ -31,8 +31,8 @@ import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletConta * @author Andy Wilkinson * @since 1.2.0 */ -public class JettyWebSocketContainerCustomizer extends - WebSocketContainerCustomizer { +public class JettyWebSocketContainerCustomizer + extends WebSocketContainerCustomizer { @Override protected void doCustomize(JettyEmbeddedServletContainerFactory container) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/TomcatWebSocketContainerCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/TomcatWebSocketContainerCustomizer.java index c29762c3f8b..1829acbf7e5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/TomcatWebSocketContainerCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/TomcatWebSocketContainerCustomizer.java @@ -33,8 +33,8 @@ import org.springframework.util.ReflectionUtils; * @author Andy Wilkinson * @since 1.2.0 */ -public class TomcatWebSocketContainerCustomizer extends - WebSocketContainerCustomizer { +public class TomcatWebSocketContainerCustomizer + extends WebSocketContainerCustomizer { private static final String TOMCAT_7_LISTENER_TYPE = "org.apache.catalina.deploy.ApplicationListener"; @@ -79,8 +79,8 @@ public class TomcatWebSocketContainerCustomizer extends } else { - Constructor constructor = ClassUtils.getConstructorIfAvailable( - listenerType, String.class, boolean.class); + Constructor constructor = ClassUtils + .getConstructorIfAvailable(listenerType, String.class, boolean.class); Object instance = BeanUtils.instantiateClass(constructor, WS_LISTENER, false); ReflectionUtils.invokeMethod(ClassUtils.getMethod(contextClass, "addApplicationListener", listenerType), context, instance); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java index 35eba0351eb..04a4ca86b1a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java @@ -29,8 +29,8 @@ import io.undertow.websockets.jsr.WebSocketDeploymentInfo; * @author Phillip Webb * @since 1.2.0 */ -public class UndertowWebSocketContainerCustomizer extends - WebSocketContainerCustomizer { +public class UndertowWebSocketContainerCustomizer + extends WebSocketContainerCustomizer { @Override protected void doCustomize(UndertowEmbeddedServletContainerFactory container) { @@ -38,8 +38,8 @@ public class UndertowWebSocketContainerCustomizer extends container.addDeploymentInfoCustomizers(customizer); } - private static class WebsocketDeploymentInfoCustomizer implements - UndertowDeploymentInfoCustomizer { + private static class WebsocketDeploymentInfoCustomizer + implements UndertowDeploymentInfoCustomizer { @Override public void customize(DeploymentInfo deploymentInfo) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java index 1d58c448a38..ab1001184c8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java @@ -59,8 +59,8 @@ public class AutoConfigurationPackagesTests { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( EmptyConfig.class); this.thrown.expect(IllegalStateException.class); - this.thrown - .expectMessage("Unable to retrieve @EnableAutoConfiguration base packages"); + this.thrown.expectMessage( + "Unable to retrieve @EnableAutoConfiguration base packages"); AutoConfigurationPackages.get(context.getBeanFactory()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java index f7a1e84f6a4..1c5a0121377 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java @@ -65,8 +65,8 @@ public class AutoConfigurationSorterTests { @Test public void byOrderAnnotation() throws Exception { - List actual = this.sorter.getInPriorityOrder(Arrays.asList(LOWEST, - HIGHEST)); + List actual = this.sorter + .getInPriorityOrder(Arrays.asList(LOWEST, HIGHEST)); assertThat(actual, nameMatcher(HIGHEST, LOWEST)); } @@ -97,8 +97,8 @@ public class AutoConfigurationSorterTests { @Test public void byAutoConfigureMixedBeforeAndAfterWithClassNames() throws Exception { - List actual = this.sorter.getInPriorityOrder(Arrays.asList(A2, B, C, W2, - X)); + List actual = this.sorter + .getInPriorityOrder(Arrays.asList(A2, B, C, W2, X)); assertThat(actual, nameMatcher(C, W2, B, A2, X)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigureConfigurationClassTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigureConfigurationClassTests.java index 5c2794892da..a4d27dcadeb 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigureConfigurationClassTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigureConfigurationClassTests.java @@ -23,6 +23,7 @@ import org.springframework.boot.test.AbstractConfigurationClassTests; * * @author Andy Wilkinson */ -public class AutoConfigureConfigurationClassTests extends AbstractConfigurationClassTests { +public class AutoConfigureConfigurationClassTests + extends AbstractConfigurationClassTests { } 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 c823a805e86..61f522438fc 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 @@ -80,8 +80,8 @@ public class PropertyPlaceholderAutoConfigurationTests { @Bean public static PropertySourcesPlaceholderConfigurer morePlaceholders() { PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); - configurer.setProperties(StringUtils.splitArrayElementsIntoProperties( - new String[] { "foo=spam" }, "=")); + configurer.setProperties(StringUtils + .splitArrayElementsIntoProperties(new String[] { "foo=spam" }, "=")); configurer.setLocalOverride(true); configurer.setOrder(0); return configurer; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/TestAutoConfigurationPackageRegistrar.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/TestAutoConfigurationPackageRegistrar.java index 3e5dcbe3d2a..4c34a3a7d6a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/TestAutoConfigurationPackageRegistrar.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/TestAutoConfigurationPackageRegistrar.java @@ -30,15 +30,15 @@ import org.springframework.util.ClassUtils; * @author Phillip Webb */ @Order(Ordered.HIGHEST_PRECEDENCE) -public class TestAutoConfigurationPackageRegistrar implements - ImportBeanDefinitionRegistrar { +public class TestAutoConfigurationPackageRegistrar + implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) { - AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(TestAutoConfigurationPackage.class.getName(), - true)); + AnnotationAttributes attributes = AnnotationAttributes + .fromMap(metadata.getAnnotationAttributes( + TestAutoConfigurationPackage.class.getName(), true)); AutoConfigurationPackages.register(registry, ClassUtils.getPackageName(attributes.getString("value"))); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java index 28ede678837..ce54d7d6daa 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java @@ -210,8 +210,10 @@ public class RabbitAutoConfigurationTests { public void enableRabbitAutomatically() throws Exception { load(NoEnableRabbitConfiguration.class); AnnotationConfigApplicationContext ctx = this.context; - ctx.getBean(RabbitListenerConfigUtils.RABBIT_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME); - ctx.getBean(RabbitListenerConfigUtils.RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME); + ctx.getBean( + RabbitListenerConfigUtils.RABBIT_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME); + ctx.getBean( + RabbitListenerConfigUtils.RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java index 54337838656..a947143ab7a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java @@ -100,8 +100,8 @@ public class BatchAutoConfigurationTests { @Test public void testNoDatabase() throws Exception { this.context = new AnnotationConfigApplicationContext(); - this.context.register(TestCustomConfiguration.class, - BatchAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + this.context.register(TestCustomConfiguration.class, BatchAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); assertNotNull(this.context.getBean(JobLauncher.class)); JobExplorer explorer = this.context.getBean(JobExplorer.class); @@ -129,8 +129,8 @@ public class BatchAutoConfigurationTests { this.context.refresh(); assertNotNull(this.context.getBean(JobLauncher.class)); this.context.getBean(JobLauncherCommandLineRunner.class).run(); - assertNotNull(this.context.getBean(JobRepository.class).getLastJobExecution( - "job", new JobParameters())); + assertNotNull(this.context.getBean(JobRepository.class).getLastJobExecution("job", + new JobParameters())); } @Test @@ -160,8 +160,8 @@ public class BatchAutoConfigurationTests { this.context.refresh(); assertNotNull(this.context.getBean(JobLauncher.class)); this.context.getBean(JobLauncherCommandLineRunner.class).run(); - assertNotNull(this.context.getBean(JobRepository.class).getLastJobExecution( - "discreteLocalJob", new JobParameters())); + assertNotNull(this.context.getBean(JobRepository.class) + .getLastJobExecution("discreteLocalJob", new JobParameters())); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java index 481e8604afd..c3105a02e83 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java @@ -88,7 +88,8 @@ public class JobLauncherCommandLineRunnerTests { }).build(); this.job = this.jobs.get("job").start(this.step).build(); this.jobExplorer = this.context.getBean(JobExplorer.class); - this.runner = new JobLauncherCommandLineRunner(this.jobLauncher, this.jobExplorer); + this.runner = new JobLauncherCommandLineRunner(this.jobLauncher, + this.jobExplorer); this.context.getBean(BatchConfiguration.class).clear(); } @@ -96,8 +97,8 @@ public class JobLauncherCommandLineRunnerTests { public void basicExecution() throws Exception { this.runner.execute(this.job, new JobParameters()); assertEquals(1, this.jobExplorer.getJobInstances("job", 0, 100).size()); - this.runner.execute(this.job, new JobParametersBuilder().addLong("id", 1L) - .toJobParameters()); + this.runner.execute(this.job, + new JobParametersBuilder().addLong("id", 1L).toJobParameters()); assertEquals(2, this.jobExplorer.getJobInstances("job", 0, 100).size()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java index 178940355ed..d76d42f568e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java @@ -180,9 +180,8 @@ public class ConditionEvaluationReportTests { @Test @SuppressWarnings("resource") public void springBootConditionPopulatesReport() throws Exception { - ConditionEvaluationReport report = ConditionEvaluationReport - .get(new AnnotationConfigApplicationContext(Config.class) - .getBeanFactory()); + ConditionEvaluationReport report = ConditionEvaluationReport.get( + new AnnotationConfigApplicationContext(Config.class).getBeanFactory()); assertThat(report.getConditionAndOutcomesBySource().size(), not(equalTo(0))); } @@ -211,12 +210,12 @@ public class ConditionEvaluationReportTests { public void duplicateOutcomes() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( DuplicateConfig.class); - ConditionEvaluationReport report = ConditionEvaluationReport.get(context - .getBeanFactory()); + ConditionEvaluationReport report = ConditionEvaluationReport + .get(context.getBeanFactory()); String autoconfigKey = MultipartAutoConfiguration.class.getName(); - ConditionAndOutcomes outcomes = report.getConditionAndOutcomesBySource().get( - autoconfigKey); + ConditionAndOutcomes outcomes = report.getConditionAndOutcomesBySource() + .get(autoconfigKey); assertThat(outcomes, not(nullValue())); assertThat(getNumberOfOutcomes(outcomes), equalTo(2)); @@ -237,11 +236,12 @@ public class ConditionEvaluationReportTests { EnvironmentTestUtils.addEnvironment(context, "test.present=true"); context.register(NegativeOuterConfig.class); context.refresh(); - ConditionEvaluationReport report = ConditionEvaluationReport.get(context - .getBeanFactory()); + ConditionEvaluationReport report = ConditionEvaluationReport + .get(context.getBeanFactory()); Map sourceOutcomes = report .getConditionAndOutcomesBySource(); - assertThat(context.containsBean("negativeOuterPositiveInnerBean"), equalTo(false)); + assertThat(context.containsBean("negativeOuterPositiveInnerBean"), + equalTo(false)); String negativeConfig = NegativeOuterConfig.class.getName(); assertThat(sourceOutcomes.get(negativeConfig).isFullMatch(), equalTo(false)); String positiveConfig = NegativeOuterConfig.PositiveInnerConfig.class.getName(); @@ -287,8 +287,8 @@ public class ConditionEvaluationReportTests { } } - static class TestMatchCondition extends SpringBootCondition implements - ConfigurationCondition { + static class TestMatchCondition extends SpringBootCondition + implements ConfigurationCondition { private final ConfigurationPhase phase; 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 6ab321b2ff1..d043954723b 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 @@ -210,8 +210,8 @@ public class ConditionalOnBeanTests { } - protected static class WithPropertyPlaceholderClassNameRegistrar implements - ImportBeanDefinitionRegistrar { + protected static class WithPropertyPlaceholderClassNameRegistrar + implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java index cac831d5427..3324f98361e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java @@ -83,16 +83,16 @@ public class ConditionalOnJavaTests { public void equalOrNewerMessage() throws Exception { ConditionOutcome outcome = this.condition.getMatchOutcome(Range.EQUAL_OR_NEWER, JavaVersion.SEVEN, JavaVersion.SIX); - assertThat(outcome.getMessage(), equalTo("Required JVM version " - + "1.6 or newer found 1.7")); + assertThat(outcome.getMessage(), + equalTo("Required JVM version " + "1.6 or newer found 1.7")); } @Test public void olderThanMessage() throws Exception { ConditionOutcome outcome = this.condition.getMatchOutcome(Range.OLDER_THAN, JavaVersion.SEVEN, JavaVersion.SIX); - assertThat(outcome.getMessage(), equalTo("Required JVM version " - + "older than 1.6 found 1.7")); + assertThat(outcome.getMessage(), + equalTo("Required JVM version " + "older than 1.6 found 1.7")); } @Test 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 c9d22f208dc..df37c1fefd2 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 @@ -271,8 +271,8 @@ public class ConditionalOnMissingBeanTests { protected static class NonspecificFactoryBeanClassAttributeConfiguration { } - protected static class NonspecificFactoryBeanClassAttributeRegistrar implements - ImportBeanDefinitionRegistrar { + protected static class NonspecificFactoryBeanClassAttributeRegistrar + implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata meta, @@ -293,8 +293,8 @@ public class ConditionalOnMissingBeanTests { protected static class NonspecificFactoryBeanStringAttributeConfiguration { } - protected static class NonspecificFactoryBeanStringAttributeRegistrar implements - ImportBeanDefinitionRegistrar { + protected static class NonspecificFactoryBeanStringAttributeRegistrar + implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata meta, @@ -302,9 +302,9 @@ public class ConditionalOnMissingBeanTests { BeanDefinitionBuilder builder = BeanDefinitionBuilder .genericBeanDefinition(NonspecificFactoryBean.class); builder.addConstructorArgValue("foo"); - builder.getBeanDefinition() - .setAttribute(OnBeanCondition.FACTORY_BEAN_OBJECT_TYPE, - ExampleBean.class.getName()); + builder.getBeanDefinition().setAttribute( + OnBeanCondition.FACTORY_BEAN_OBJECT_TYPE, + ExampleBean.class.getName()); registry.registerBeanDefinition("exampleBeanFactoryBean", builder.getBeanDefinition()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java index 89da1b27d7e..c34e0dc198a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java @@ -94,7 +94,8 @@ public class ConditionalOnPropertyTests { @Test public void nonRelaxedName() throws Exception { - load(NonRelaxedPropertiesRequiredConfiguration.class, "theRelaxedProperty=value1"); + load(NonRelaxedPropertiesRequiredConfiguration.class, + "theRelaxedProperty=value1"); assertFalse(this.context.containsBean("foo")); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java index abf370c10b4..e3b8ca36578 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java @@ -40,8 +40,8 @@ public class SpringBootConditionTests { @Test public void sensibleClassException() { this.thrown.expect(IllegalStateException.class); - this.thrown.expectMessage("Error processing condition on " - + ErrorOnClass.class.getName()); + this.thrown.expectMessage( + "Error processing condition on " + ErrorOnClass.class.getName()); new AnnotationConfigApplicationContext(ErrorOnClass.class); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java index c1fbdbd92db..a6446769a8b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java @@ -66,8 +66,8 @@ public class JpaRepositoriesAutoConfigurationTests { public void testOverrideRepositoryConfiguration() throws Exception { prepareApplicationContext(CustomConfiguration.class); - assertNotNull(this.context - .getBean(org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository.class)); + assertNotNull(this.context.getBean( + org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository.class)); assertNotNull(this.context.getBean(PlatformTransactionManager.class)); assertNotNull(this.context.getBean(EntityManagerFactory.class)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java index 05211a891c5..6ae3d2880da 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java @@ -63,8 +63,8 @@ public class JpaWebAutoConfigurationTests { this.context.refresh(); assertNotNull(this.context.getBean(CityRepository.class)); assertNotNull(this.context.getBean(PageableHandlerMethodArgumentResolver.class)); - assertTrue(this.context.getBean(FormattingConversionService.class).canConvert( - Long.class, City.class)); + assertTrue(this.context.getBean(FormattingConversionService.class) + .canConvert(Long.class, City.class)); } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java index 73451228903..a6fe9bde1b0 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java @@ -100,7 +100,8 @@ public class MixedMongoRepositoriesAutoConfigurationTests { } @Test - public void testJpaRepositoryConfigurationWithMongoOverlapDisabled() throws Exception { + public void testJpaRepositoryConfigurationWithMongoOverlapDisabled() + throws Exception { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.initialize:false", diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java index 8becebb5822..28d70812a0b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java @@ -99,8 +99,8 @@ public class MongoDataAutoConfigurationTests { MongoAutoConfiguration.class, MongoDataAutoConfiguration.class); this.context.refresh(); MongoTemplate template = this.context.getBean(MongoTemplate.class); - assertTrue(template.getConverter().getConversionService() - .canConvert(Mongo.class, Boolean.class)); + assertTrue(template.getConverter().getConversionService().canConvert(Mongo.class, + Boolean.class)); } @Test @@ -161,8 +161,8 @@ public class MongoDataAutoConfigurationTests { @SuppressWarnings({ "unchecked", "rawtypes" }) private static void assertDomainTypesDiscovered(MongoMappingContext mappingContext, Class... types) { - Set initialEntitySet = (Set) ReflectionTestUtils.getField( - mappingContext, "initialEntitySet"); + Set initialEntitySet = (Set) ReflectionTestUtils + .getField(mappingContext, "initialEntitySet"); assertThat(initialEntitySet, hasSize(types.length)); assertThat(initialEntitySet, Matchers.hasItems(types)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java index 011c8a907d2..f1fa0ec7e1a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java @@ -88,7 +88,8 @@ public class FlywayAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "flyway.url:jdbc:hsqldb:mem:flywaytest", "flyway.user:sa"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); Flyway flyway = this.context.getBean(Flyway.class); assertNotNull(flyway.getDataSource()); } @@ -105,10 +106,11 @@ public class FlywayAutoConfigurationTests { @Test public void defaultFlyway() throws Exception { registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); Flyway flyway = this.context.getBean(Flyway.class); - assertEquals("[classpath:db/migration]", Arrays.asList(flyway.getLocations()) - .toString()); + assertEquals("[classpath:db/migration]", + Arrays.asList(flyway.getLocations()).toString()); } @Test @@ -116,7 +118,8 @@ public class FlywayAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "flyway.locations:classpath:db/changelog,classpath:db/migration"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); Flyway flyway = this.context.getBean(Flyway.class); assertEquals("[classpath:db/changelog, classpath:db/migration]", Arrays.asList(flyway.getLocations()).toString()); @@ -126,7 +129,8 @@ public class FlywayAutoConfigurationTests { public void overrideSchemas() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, "flyway.schemas:public"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); Flyway flyway = this.context.getBean(Flyway.class); assertEquals("[public]", Arrays.asList(flyway.getSchemas()).toString()); } @@ -137,7 +141,8 @@ public class FlywayAutoConfigurationTests { "flyway.locations:file:no-such-dir"); this.thrown.expect(BeanCreationException.class); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); } @Test @@ -148,7 +153,8 @@ public class FlywayAutoConfigurationTests { this.thrown.expect(BeanCreationException.class); this.thrown.expectMessage("Cannot find migrations location in"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); } @Test @@ -157,7 +163,8 @@ public class FlywayAutoConfigurationTests { "flyway.locations:classpath:db/changelog,classpath:db/migration", "flyway.check-location:true"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java index 4153a7598fb..18d40ddb3e3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java @@ -134,7 +134,8 @@ public class FreeMarkerAutoConfigurationTests { @Test public void customTemplateLoaderPath() throws Exception { - registerAndRefreshContext("spring.freemarker.templateLoaderPath:classpath:/custom-templates/"); + registerAndRefreshContext( + "spring.freemarker.templateLoaderPath:classpath:/custom-templates/"); MockHttpServletResponse response = render("custom"); String result = response.getContentAsString(); assertThat(result, containsString("custom")); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java index 2a7401426d7..5beda804b05 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java @@ -40,8 +40,8 @@ public class FreeMarkerTemplateAvailabilityProviderTests { @Test public void availabilityOfTemplateInDefaultLocation() { - assertTrue(this.provider.isTemplateAvailable("home", this.environment, getClass() - .getClassLoader(), this.resourceLoader)); + assertTrue(this.provider.isTemplateAvailable("home", this.environment, + getClass().getClassLoader(), this.resourceLoader)); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java index f285d300482..eada0553fa3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java @@ -113,8 +113,8 @@ public class HypermediaAutoConfigurationTests { this.context.refresh(); ObjectMapper objectMapper = this.context.getBean("_halObjectMapper", ObjectMapper.class); - assertTrue(objectMapper.getSerializationConfig().isEnabled( - SerializationFeature.INDENT_OUTPUT)); + assertTrue(objectMapper.getSerializationConfig() + .isEnabled(SerializationFeature.INDENT_OUTPUT)); } @Test 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 af1847fa48f..1ef93937cd4 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 @@ -54,15 +54,15 @@ public class CommonsDataSourceConfigurationTests { @Test public void testDataSourcePropertiesOverridden() throws Exception { this.context.register(CommonsDataSourceConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "url:jdbc:foo//bar/spam"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "url:jdbc:foo//bar/spam"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testWhileIdle:true"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testOnBorrow:true"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testOnReturn:true"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "timeBetweenEvictionRunsMillis:10000"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "minEvictableIdleTimeMillis:12345"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "timeBetweenEvictionRunsMillis:10000"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "minEvictableIdleTimeMillis:12345"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "maxWait:1234"); this.context.refresh(); BasicDataSource ds = this.context.getBean(BasicDataSource.class); 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 6a9184f2b1b..0a7b7ca327c 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 @@ -171,11 +171,9 @@ public class DataSourceAutoConfigurationTests { @Test public void testExplicitDriverClassClearsUserName() throws Exception { - EnvironmentTestUtils - .addEnvironment( - this.context, - "spring.datasource.driverClassName:org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfigurationTests$DatabaseDriver", - "spring.datasource.url:jdbc:foo://localhost"); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.datasource.driverClassName:org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfigurationTests$DatabaseDriver", + "spring.datasource.url:jdbc:foo://localhost"); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); @@ -234,19 +232,19 @@ public class DataSourceAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.driverClassName:org.hsqldb.jdbcDriver", "spring.datasource.url:jdbc:hsqldb:mem:testdb"); - this.context.setClassLoader(new URLClassLoader(new URL[0], getClass() - .getClassLoader()) { - @Override - protected Class loadClass(String name, boolean resolve) - throws ClassNotFoundException { - for (String hiddenPackage : hiddenPackages) { - if (name.startsWith(hiddenPackage)) { - throw new ClassNotFoundException(); + this.context.setClassLoader( + new URLClassLoader(new URL[0], getClass().getClassLoader()) { + @Override + protected Class loadClass(String name, boolean resolve) + throws ClassNotFoundException { + for (String hiddenPackage : hiddenPackages) { + if (name.startsWith(hiddenPackage)) { + throw new ClassNotFoundException(); + } + } + return super.loadClass(name, resolve); } - } - return super.loadClass(name, resolve); - } - }); + }); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java index 46261a89e32..0dd55cb9949 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java @@ -107,16 +107,12 @@ public class DataSourceInitializerTests { public void testDataSourceInitializedWithExplicitScript() throws Exception { this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - EnvironmentTestUtils - .addEnvironment( - this.context, - "spring.datasource.initialize:true", - "spring.datasource.schema:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "schema.sql"), - "spring.datasource.data:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "data.sql")); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.datasource.initialize:true", + "spring.datasource.schema:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "schema.sql"), + "spring.datasource.data:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "data.sql")); this.context.refresh(); DataSource dataSource = this.context.getBean(DataSource.class); assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource); @@ -128,19 +124,16 @@ public class DataSourceInitializerTests { @Test public void testDataSourceInitializedWithMultipleScripts() throws Exception { - EnvironmentTestUtils - .addEnvironment( - this.context, - "spring.datasource.initialize:true", - "spring.datasource.schema:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "schema.sql") - + "," - + ClassUtils.addResourcePathToPackagePath(getClass(), - "another.sql"), - "spring.datasource.data:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "data.sql")); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.datasource.initialize:true", + "spring.datasource.schema:" + + ClassUtils.addResourcePathToPackagePath(getClass(), + "schema.sql") + + "," + + ClassUtils.addResourcePathToPackagePath(getClass(), + "another.sql"), + "spring.datasource.data:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "data.sql")); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); @@ -155,19 +148,17 @@ public class DataSourceInitializerTests { } @Test - public void testDataSourceInitializedWithExplicitSqlScriptEncoding() throws Exception { + public void testDataSourceInitializedWithExplicitSqlScriptEncoding() + throws Exception { this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - EnvironmentTestUtils.addEnvironment( - this.context, + EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.initialize:true", "spring.datasource.sqlScriptEncoding:UTF-8", - "spring.datasource.schema:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "encoding-schema.sql"), - "spring.datasource.data:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "encoding-data.sql")); + "spring.datasource.schema:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "encoding-schema.sql"), + "spring.datasource.data:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "encoding-data.sql")); this.context.refresh(); DataSource dataSource = this.context.getBean(DataSource.class); assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java index a36b1d1a61d..8ee489b5dce 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java @@ -90,8 +90,7 @@ public class DataSourceJsonSerializationTests { for (PropertyDescriptor property : BeanUtils .getPropertyDescriptors(DataSource.class)) { Method reader = property.getReadMethod(); - if (reader != null - && property.getWriteMethod() != null + if (reader != null && property.getWriteMethod() != null && this.conversionService.canConvert(String.class, property.getPropertyType())) { jgen.writeObjectField(property.getName(), @@ -115,9 +114,8 @@ public class DataSourceJsonSerializationTests { AnnotatedMethod setter = beanDesc.findMethod( "set" + StringUtils.capitalize(writer.getName()), new Class[] { writer.getPropertyType() }); - if (setter != null - && this.conversionService.canConvert(String.class, - writer.getPropertyType())) { + if (setter != null && this.conversionService.canConvert(String.class, + writer.getPropertyType())) { result.add(writer); } } 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 4069c012a9f..673bc61895a 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 @@ -48,8 +48,8 @@ public class DataSourceTransactionManagerAutoConfigurationTests { this.context.refresh(); assertNotNull(this.context.getBean(DataSource.class)); assertNotNull(this.context.getBean(DataSourceTransactionManager.class)); - assertNotNull(this.context - .getBean(AbstractTransactionManagementConfiguration.class)); + assertNotNull( + this.context.getBean(AbstractTransactionManagementConfiguration.class)); } @Test @@ -57,9 +57,8 @@ public class DataSourceTransactionManagerAutoConfigurationTests { this.context.register(DataSourceTransactionManagerAutoConfiguration.class); this.context.refresh(); assertEquals(0, this.context.getBeanNamesForType(DataSource.class).length); - assertEquals( - 0, - this.context.getBeanNamesForType(DataSourceTransactionManager.class).length); + assertEquals(0, this.context + .getBeanNamesForType(DataSourceTransactionManager.class).length); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriverTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriverTests.java index 53987b2b8c1..748167b8437 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriverTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriverTests.java @@ -38,15 +38,15 @@ public class DatabaseDriverTests { @Test public void classNameForKnownDatabase() { - String driverClassName = DatabaseDriver.fromJdbcUrl( - "jdbc:postgresql://hostname/dbname").getDriverClassName(); + String driverClassName = DatabaseDriver + .fromJdbcUrl("jdbc:postgresql://hostname/dbname").getDriverClassName(); assertEquals("org.postgresql.Driver", driverClassName); } @Test public void nullClassNameForUnknownDatabase() { - String driverClassName = DatabaseDriver.fromJdbcUrl( - "jdbc:unknowndb://hostname/dbname").getDriverClassName(); + String driverClassName = DatabaseDriver + .fromJdbcUrl("jdbc:unknowndb://hostname/dbname").getDriverClassName(); assertNull(driverClassName); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java index a9da2b94f7c..737d90e38d2 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java @@ -62,8 +62,8 @@ public class HikariDataSourceConfigurationTests { @Test public void testDataSourcePropertiesOverridden() throws Exception { this.context.register(HikariDataSourceConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "jdbcUrl:jdbc:foo//bar/spam"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "jdbcUrl:jdbc:foo//bar/spam"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "maxLifetime:1234"); this.context.refresh(); HikariDataSource ds = this.context.getBean(HikariDataSource.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java index ae0ae156295..dd994f22aa6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java @@ -83,8 +83,8 @@ public class JndiDataSourceAutoConfigurationTests { } @Test - public void dataSourceIsAvailableFromJndi() throws IllegalStateException, - NamingException { + public void dataSourceIsAvailableFromJndi() + throws IllegalStateException, NamingException { DataSource dataSource = new BasicDataSource(); configureJndi("foo", dataSource); @@ -99,8 +99,8 @@ public class JndiDataSourceAutoConfigurationTests { @SuppressWarnings("unchecked") @Test - public void mbeanDataSourceIsExcludedFromExport() throws IllegalStateException, - NamingException { + public void mbeanDataSourceIsExcludedFromExport() + throws IllegalStateException, NamingException { DataSource dataSource = new BasicDataSource(); configureJndi("foo", dataSource); @@ -120,8 +120,8 @@ public class JndiDataSourceAutoConfigurationTests { @SuppressWarnings("unchecked") @Test - public void standardDataSourceIsNotExcludedFromExport() throws IllegalStateException, - NamingException { + public void standardDataSourceIsNotExcludedFromExport() + throws IllegalStateException, NamingException { DataSource dataSource = new org.apache.commons.dbcp.BasicDataSource(); configureJndi("foo", dataSource); 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 6a69224f3a5..da9f23ad9b7 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 @@ -73,20 +73,20 @@ public class TomcatDataSourceConfigurationTests { @Test public void testDataSourcePropertiesOverridden() throws Exception { this.context.register(TomcatDataSourceConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "url:jdbc:foo//bar/spam"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "url:jdbc:foo//bar/spam"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testWhileIdle:true"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testOnBorrow:true"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testOnReturn:true"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "timeBetweenEvictionRunsMillis:10000"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "minEvictableIdleTimeMillis:12345"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "timeBetweenEvictionRunsMillis:10000"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "minEvictableIdleTimeMillis:12345"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "maxWait:1234"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "jdbcInterceptors:SlowQueryReport"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "validationInterval:9999"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "jdbcInterceptors:SlowQueryReport"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "validationInterval:9999"); this.context.refresh(); org.apache.tomcat.jdbc.pool.DataSource ds = this.context .getBean(org.apache.tomcat.jdbc.pool.DataSource.class); @@ -146,8 +146,7 @@ public class TomcatDataSourceConfigurationTests { DataSourceBuilder factory = DataSourceBuilder .create(this.properties.getClassLoader()) .driverClassName(this.properties.getDriverClassName()) - .url(this.properties.getUrl()) - .username(this.properties.getUsername()) + .url(this.properties.getUrl()).username(this.properties.getUsername()) .password(this.properties.getPassword()) .type(org.apache.tomcat.jdbc.pool.DataSource.class); return factory.build(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java index 8000edb1176..48d64224d1f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java @@ -64,8 +64,7 @@ public class XADataSourceAutoConfigurationTests { @Test public void createFromClass() throws Exception { - ApplicationContext context = createContext( - FromProperties.class, + ApplicationContext context = createContext(FromProperties.class, "spring.datasource.xa.data-source-class-name:org.hsqldb.jdbc.pool.JDBCXADataSource", "spring.datasource.xa.properties.database-name:test"); context.getBean(DataSource.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadataTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadataTests.java index 58458a64477..452464707dc 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadataTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadataTests.java @@ -54,12 +54,12 @@ public abstract class AbstractDataSourcePoolMetadataTests() { @Override - public Void doInConnection(Connection connection) throws SQLException, - DataAccessException { + public Void doInConnection(Connection connection) + throws SQLException, DataAccessException { return null; } }); @@ -69,12 +69,12 @@ public abstract class AbstractDataSourcePoolMetadataTests() { @Override - public Void doInConnection(Connection connection) throws SQLException, - DataAccessException { + public Void doInConnection(Connection connection) + throws SQLException, DataAccessException { assertEquals(Integer.valueOf(1), getDataSourceMetadata().getActive()); assertEquals(Float.valueOf(0.5F), getDataSourceMetadata().getUsage()); return null; @@ -84,20 +84,20 @@ public abstract class AbstractDataSourcePoolMetadataTests() { @Override - public Void doInConnection(Connection connection) throws SQLException, - DataAccessException { + public Void doInConnection(Connection connection) + throws SQLException, DataAccessException { jdbcTemplate.execute(new ConnectionCallback() { @Override public Void doInConnection(Connection connection) throws SQLException, DataAccessException { - assertEquals(Integer.valueOf(2), getDataSourceMetadata() - .getActive()); - assertEquals(Float.valueOf(1F), getDataSourceMetadata() - .getUsage()); + assertEquals(Integer.valueOf(2), + getDataSourceMetadata().getActive()); + assertEquals(Float.valueOf(1F), + getDataSourceMetadata().getUsage()); return null; } }); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java index ddc83637779..8a62ecccf5d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java @@ -28,8 +28,8 @@ import static org.junit.Assert.assertNull; * * @author Stephane Nicoll */ -public class CommonsDbcpDataSourcePoolMetadataTests extends - AbstractDataSourcePoolMetadataTests { +public class CommonsDbcpDataSourcePoolMetadataTests + extends AbstractDataSourcePoolMetadataTests { private CommonsDbcpDataSourcePoolMetadata dataSourceMetadata; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersTests.java index 6fd985cbf9a..b9dbd9c4dc4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersTests.java @@ -71,7 +71,8 @@ public class DataSourcePoolMetadataProvidersTests { DataSourcePoolMetadataProviders provider = new DataSourcePoolMetadataProviders( Arrays.asList(this.firstProvider, this.secondProvider)); assertSame(this.first, provider.getDataSourcePoolMetadata(this.firstDataSource)); - assertSame(this.second, provider.getDataSourcePoolMetadata(this.secondDataSource)); + assertSame(this.second, + provider.getDataSourcePoolMetadata(this.secondDataSource)); assertNull(provider.getDataSourcePoolMetadata(this.unknownDataSource)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadataTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadataTests.java index a0b4377ccb0..39dfd2017d9 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadataTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadataTests.java @@ -27,14 +27,15 @@ import static org.junit.Assert.assertEquals; * * @author Stephane Nicoll */ -public class HikariDataSourcePoolMetadataTests extends - AbstractDataSourcePoolMetadataTests { +public class HikariDataSourcePoolMetadataTests + extends AbstractDataSourcePoolMetadataTests { private HikariDataSourcePoolMetadata dataSourceMetadata; @Before public void setup() { - this.dataSourceMetadata = new HikariDataSourcePoolMetadata(createDataSource(0, 2)); + this.dataSourceMetadata = new HikariDataSourcePoolMetadata( + createDataSource(0, 2)); } @Override @@ -51,8 +52,8 @@ public class HikariDataSourcePoolMetadataTests extends } private HikariDataSource createDataSource(int minSize, int maxSize) { - HikariDataSource dataSource = (HikariDataSource) initializeBuilder().type( - HikariDataSource.class).build(); + HikariDataSource dataSource = (HikariDataSource) initializeBuilder() + .type(HikariDataSource.class).build(); dataSource.setMinimumIdle(minSize); dataSource.setMaximumPoolSize(maxSize); return dataSource; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadataTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadataTests.java index d98ad1a8468..367d1e9ac49 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadataTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadataTests.java @@ -26,14 +26,15 @@ import static org.junit.Assert.assertEquals; * * @author Stephane Nicoll */ -public class TomcatDataSourcePoolMetadataTests extends - AbstractDataSourcePoolMetadataTests { +public class TomcatDataSourcePoolMetadataTests + extends AbstractDataSourcePoolMetadataTests { private TomcatDataSourcePoolMetadata dataSourceMetadata; @Before public void setup() { - this.dataSourceMetadata = new TomcatDataSourcePoolMetadata(createDataSource(0, 2)); + this.dataSourceMetadata = new TomcatDataSourcePoolMetadata( + createDataSource(0, 2)); } @Override diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java index 09be3545b96..31aa518cd2c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java @@ -64,8 +64,8 @@ public class JerseyAutoConfigurationDefaultFilterPathTests { @Test public void contextLoads() { - ResponseEntity entity = this.restTemplate.getForEntity( - "http://localhost:" + this.port + "/hello", String.class); + ResponseEntity entity = this.restTemplate + .getForEntity("http://localhost:" + this.port + "/hello", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java index 9cab0ad9132..8619e2c8378 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java @@ -64,8 +64,8 @@ public class JerseyAutoConfigurationDefaultServletPathTests { @Test public void contextLoads() { - ResponseEntity entity = this.restTemplate.getForEntity( - "http://localhost:" + this.port + "/hello", String.class); + ResponseEntity entity = this.restTemplate + .getForEntity("http://localhost:" + this.port + "/hello", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java index fd13a0e5d72..143dadfa9fd 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java @@ -92,8 +92,8 @@ public class JmsAutoConfigurationTests { @Test public void testConnectionFactoryBackOff() { load(TestConfiguration2.class); - assertEquals("foobar", this.context.getBean(ActiveMQConnectionFactory.class) - .getBrokerURL()); + assertEquals("foobar", + this.context.getBean(ActiveMQConnectionFactory.class).getBrokerURL()); } @Test @@ -117,8 +117,8 @@ public class JmsAutoConfigurationTests { TestConfiguration5.class); JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class); assertEquals(999, jmsTemplate.getPriority()); - assertEquals("foobar", this.context.getBean(ActiveMQConnectionFactory.class) - .getBrokerURL()); + assertEquals("foobar", + this.context.getBean(ActiveMQConnectionFactory.class).getBrokerURL()); JmsMessagingTemplate messagingTemplate = this.context .getBean(JmsMessagingTemplate.class); assertEquals("fooBar", messagingTemplate.getDefaultDestinationName()); @@ -128,8 +128,8 @@ public class JmsAutoConfigurationTests { @Test public void testEnableJmsCreateDefaultContainerFactory() { load(EnableJmsConfiguration.class); - JmsListenerContainerFactory jmsListenerContainerFactory = this.context - .getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class); + JmsListenerContainerFactory jmsListenerContainerFactory = this.context.getBean( + "jmsListenerContainerFactory", JmsListenerContainerFactory.class); assertEquals(DefaultJmsListenerContainerFactory.class, jmsListenerContainerFactory.getClass()); } @@ -138,8 +138,8 @@ public class JmsAutoConfigurationTests { public void testJmsListenerContainerFactoryBackOff() { this.context = createContext(TestConfiguration6.class, EnableJmsConfiguration.class); - JmsListenerContainerFactory jmsListenerContainerFactory = this.context - .getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class); + JmsListenerContainerFactory jmsListenerContainerFactory = this.context.getBean( + "jmsListenerContainerFactory", JmsListenerContainerFactory.class); assertEquals(SimpleJmsListenerContainerFactory.class, jmsListenerContainerFactory.getClass()); } @@ -167,8 +167,8 @@ public class JmsAutoConfigurationTests { public void testDefaultContainerFactoryWithJtaTransactionManager() { this.context = createContext(TestConfiguration7.class, EnableJmsConfiguration.class); - JmsListenerContainerFactory jmsListenerContainerFactory = this.context - .getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class); + JmsListenerContainerFactory jmsListenerContainerFactory = this.context.getBean( + "jmsListenerContainerFactory", JmsListenerContainerFactory.class); assertEquals(DefaultJmsListenerContainerFactory.class, jmsListenerContainerFactory.getClass()); DefaultMessageListenerContainer listenerContainer = ((DefaultJmsListenerContainerFactory) jmsListenerContainerFactory) @@ -184,8 +184,8 @@ public class JmsAutoConfigurationTests { public void testDefaultContainerFactoryNonJtaTransactionManager() { this.context = createContext(TestConfiguration8.class, EnableJmsConfiguration.class); - JmsListenerContainerFactory jmsListenerContainerFactory = this.context - .getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class); + JmsListenerContainerFactory jmsListenerContainerFactory = this.context.getBean( + "jmsListenerContainerFactory", JmsListenerContainerFactory.class); assertEquals(DefaultJmsListenerContainerFactory.class, jmsListenerContainerFactory.getClass()); DefaultMessageListenerContainer listenerContainer = ((DefaultJmsListenerContainerFactory) jmsListenerContainerFactory) @@ -199,8 +199,8 @@ public class JmsAutoConfigurationTests { @Test public void testDefaultContainerFactoryNoTransactionManager() { this.context = createContext(EnableJmsConfiguration.class); - JmsListenerContainerFactory jmsListenerContainerFactory = this.context - .getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class); + JmsListenerContainerFactory jmsListenerContainerFactory = this.context.getBean( + "jmsListenerContainerFactory", JmsListenerContainerFactory.class); assertEquals(DefaultJmsListenerContainerFactory.class, jmsListenerContainerFactory.getClass()); DefaultMessageListenerContainer listenerContainer = ((DefaultJmsListenerContainerFactory) jmsListenerContainerFactory) @@ -264,7 +264,8 @@ public class JmsAutoConfigurationTests { @Test public void testActiveMQOverriddenRemoteHost() { - load(TestConfiguration.class, "spring.activemq.brokerUrl:tcp://remote-host:10000"); + load(TestConfiguration.class, + "spring.activemq.brokerUrl:tcp://remote-host:10000"); JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class); ActiveMQConnectionFactory connectionFactory = this.context .getBean(ActiveMQConnectionFactory.class); @@ -404,7 +405,8 @@ public class JmsAutoConfigurationTests { @Bean JmsMessagingTemplate jmsMessagingTemplate(JmsTemplate jmsTemplate) { - JmsMessagingTemplate messagingTemplate = new JmsMessagingTemplate(jmsTemplate); + JmsMessagingTemplate messagingTemplate = new JmsMessagingTemplate( + jmsTemplate); messagingTemplate.setDefaultDestinationName("fooBar"); return messagingTemplate; } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java index c0f4b8ee9ff..0bcdcf3cc6e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java @@ -56,7 +56,8 @@ public class ActiveMQAutoConfigurationTests { @Test public void configurationBacksOffWhenCustomConnectionFactoryExists() { load(CustomConnectionFactoryConfiguration.class); - assertTrue(mockingDetails(this.context.getBean(ConnectionFactory.class)).isMock()); + assertTrue( + mockingDetails(this.context.getBean(ConnectionFactory.class)).isMock()); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java index 68ae0ed1ae4..c2d7bf5e3a7 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java @@ -35,32 +35,32 @@ public class ActiveMQPropertiesTests { @Test public void getBrokerUrlIsInMemoryByDefault() { - assertEquals(DEFAULT_EMBEDDED_BROKER_URL, new ActiveMQConnectionFactoryFactory( - this.properties).determineBrokerUrl()); - } - - @Test - public void getBrokerUrlUseExplicitBrokerUrl() { - this.properties.setBrokerUrl("vm://foo-bar"); - assertEquals("vm://foo-bar", + assertEquals(DEFAULT_EMBEDDED_BROKER_URL, new ActiveMQConnectionFactoryFactory(this.properties) .determineBrokerUrl()); } + @Test + public void getBrokerUrlUseExplicitBrokerUrl() { + this.properties.setBrokerUrl("vm://foo-bar"); + assertEquals("vm://foo-bar", new ActiveMQConnectionFactoryFactory(this.properties) + .determineBrokerUrl()); + } + @Test public void getBrokerUrlWithInMemorySetToFalse() { this.properties.setInMemory(false); - assertEquals(DEFAULT_NETWORK_BROKER_URL, new ActiveMQConnectionFactoryFactory( - this.properties).determineBrokerUrl()); + assertEquals(DEFAULT_NETWORK_BROKER_URL, + new ActiveMQConnectionFactoryFactory(this.properties) + .determineBrokerUrl()); } @Test public void getExplicitBrokerUrlAlwaysWins() { this.properties.setBrokerUrl("vm://foo-bar"); this.properties.setInMemory(false); - assertEquals("vm://foo-bar", - new ActiveMQConnectionFactoryFactory(this.properties) - .determineBrokerUrl()); + assertEquals("vm://foo-bar", new ActiveMQConnectionFactoryFactory(this.properties) + .determineBrokerUrl()); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfigurationTests.java index f83d9841f2a..154c69bb590 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfigurationTests.java @@ -185,7 +185,8 @@ public class HornetQAutoConfigurationTests { @Test public void embeddedServiceWithCustomJmsConfiguration() { // Ignored with custom config - load(CustomJmsConfiguration.class, "spring.hornetq.embedded.queues=Queue1,Queue2"); + load(CustomJmsConfiguration.class, + "spring.hornetq.embedded.queues=Queue1,Queue2"); DestinationChecker checker = new DestinationChecker(this.context); checker.checkQueue("custom", true); // See CustomJmsConfiguration @@ -284,7 +285,8 @@ public class HornetQAutoConfigurationTests { private TransportConfiguration assertInVmConnectionFactory( HornetQConnectionFactory connectionFactory) { - TransportConfiguration transportConfig = getSingleTransportConfiguration(connectionFactory); + TransportConfiguration transportConfig = getSingleTransportConfiguration( + connectionFactory); assertEquals(InVMConnectorFactory.class.getName(), transportConfig.getFactoryClassName()); return transportConfig; @@ -292,7 +294,8 @@ public class HornetQAutoConfigurationTests { private TransportConfiguration assertNettyConnectionFactory( HornetQConnectionFactory connectionFactory, String host, int port) { - TransportConfiguration transportConfig = getSingleTransportConfiguration(connectionFactory); + TransportConfiguration transportConfig = getSingleTransportConfiguration( + connectionFactory); assertEquals(NettyConnectorFactory.class.getName(), transportConfig.getFactoryClassName()); assertEquals(host, transportConfig.getParams().get("host")); @@ -392,8 +395,8 @@ public class HornetQAutoConfigurationTests { @Bean public JMSConfiguration myJmsConfiguration() { JMSConfiguration config = new JMSConfigurationImpl(); - config.getQueueConfigurations().add( - new JMSQueueConfigurationImpl("custom", null, false)); + config.getQueueConfigurations() + .add(new JMSQueueConfigurationImpl("custom", null, false)); return config; } } @@ -405,7 +408,8 @@ public class HornetQAutoConfigurationTests { public HornetQConfigurationCustomizer myHornetQCustomize() { return new HornetQConfigurationCustomizer() { @Override - public void customize(org.hornetq.core.config.Configuration configuration) { + public void customize( + org.hornetq.core.config.Configuration configuration) { configuration.setClusterPassword("Foobar"); configuration.setName("customFooBar"); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java index f5e387fd396..3de5436220a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java @@ -144,8 +144,8 @@ public class LiquibaseAutoConfigurationTests { PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class); - assertEquals("jdbc:hsqldb:mem:liquibase", liquibase.getDataSource() - .getConnection().getMetaData().getURL()); + assertEquals("jdbc:hsqldb:mem:liquibase", + liquibase.getDataSource().getConnection().getMetaData().getURL()); } @Test(expected = BeanCreationException.class) diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java index 10b3179748e..b0f42f3ff0c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java @@ -172,7 +172,8 @@ public class AutoConfigurationReportLoggingInitializerTests { } // Just basic sanity check, test is for visual inspection String l = this.debugLog.get(0); - assertThat(l, containsString("not a web application (OnWebApplicationCondition)")); + assertThat(l, + containsString("not a web application (OnWebApplicationCondition)")); } @Test @@ -196,9 +197,9 @@ public class AutoConfigurationReportLoggingInitializerTests { @Test public void noErrorIfNotInitialized() throws Exception { - this.initializer.onApplicationEvent(new ApplicationFailedEvent( - new SpringApplication(), new String[0], null, new RuntimeException( - "Planned"))); + this.initializer + .onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(), + new String[0], null, new RuntimeException("Planned"))); assertThat(this.infoLog.get(0), containsString("Unable to provide auto-configuration report")); } @@ -216,8 +217,7 @@ public class AutoConfigurationReportLoggingInitializerTests { } @Configuration - @Import({ WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, + @Import({ WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) static class Config { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java index ccc68f3ff0d..467e3c33e23 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java @@ -61,8 +61,8 @@ public class MongoAutoConfigurationTests { this.context.register(OptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class); this.context.refresh(); - assertEquals(300, this.context.getBean(Mongo.class).getMongoOptions() - .getSocketTimeout()); + assertEquals(300, + this.context.getBean(Mongo.class).getMongoOptions().getSocketTimeout()); } @SuppressWarnings("deprecation") @@ -74,8 +74,8 @@ public class MongoAutoConfigurationTests { this.context.register(OptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class); this.context.refresh(); - assertEquals(300, this.context.getBean(Mongo.class).getMongoOptions() - .getSocketTimeout()); + assertEquals(300, + this.context.getBean(Mongo.class).getMongoOptions().getSocketTimeout()); } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java index db778c6de8a..e727d19c0a3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java @@ -70,15 +70,15 @@ public class MustacheAutoConfigurationIntegrationTests { @Test public void testHomePage() throws Exception { - String body = new TestRestTemplate().getForObject( - "http://localhost:" + this.port, String.class); + String body = new TestRestTemplate().getForObject("http://localhost:" + this.port, + String.class); assertTrue(body.contains("Hello World")); } @Test public void testPartialPage() throws Exception { - String body = new TestRestTemplate().getForObject("http://localhost:" + this.port - + "/partial", String.class); + String body = new TestRestTemplate() + .getForObject("http://localhost:" + this.port + "/partial", String.class); assertTrue(body.contains("Hello World")); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java index 0e1809ed05d..f74618a793f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java @@ -48,24 +48,20 @@ public class MustacheStandaloneIntegrationTests { @Test public void directCompilation() throws Exception { - assertEquals( - "Hello: World", - this.compiler.compile("Hello: {{world}}").execute( - Collections.singletonMap("world", "World"))); + assertEquals("Hello: World", this.compiler.compile("Hello: {{world}}") + .execute(Collections.singletonMap("world", "World"))); } @Test public void environmentCollectorCompoundKey() throws Exception { - assertEquals("Hello: Heaven", this.compiler.compile("Hello: {{env.foo}}") - .execute(new Object())); + assertEquals("Hello: Heaven", + this.compiler.compile("Hello: {{env.foo}}").execute(new Object())); } @Test public void environmentCollectorCompoundKeyStandard() throws Exception { - assertEquals( - "Hello: Heaven", - this.compiler.standardsMode(true).compile("Hello: {{env.foo}}") - .execute(new Object())); + assertEquals("Hello: Heaven", this.compiler.standardsMode(true) + .compile("Hello: {{env.foo}}").execute(new Object())); } @Test @@ -75,7 +71,8 @@ public class MustacheStandaloneIntegrationTests { } @Configuration - @Import({ MustacheAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + @Import({ MustacheAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) protected static class Application { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java index 96883572121..843ac778e62 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java @@ -55,9 +55,11 @@ public class MustacheViewTests { @Test public void viewResolvesHandlebars() throws Exception { - MustacheView view = new MustacheView(Mustache.compiler().compile("Hello {{msg}}")); + MustacheView view = new MustacheView( + Mustache.compiler().compile("Hello {{msg}}")); view.setApplicationContext(this.context); - view.render(Collections.singletonMap("msg", "World"), this.request, this.response); + view.render(Collections.singletonMap("msg", "World"), this.request, + this.response); assertEquals("Hello World", this.response.getContentAsString()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java index 0bd259053e4..fd2f3ba15ec 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java @@ -87,15 +87,15 @@ public class MustacheWebIntegrationTests { @Test public void testHomePage() throws Exception { - String body = new TestRestTemplate().getForObject( - "http://localhost:" + this.port, String.class); + String body = new TestRestTemplate().getForObject("http://localhost:" + this.port, + String.class); assertTrue(body.contains("Hello World")); } @Test public void testPartialPage() throws Exception { - String body = new TestRestTemplate().getForObject("http://localhost:" + this.port - + "/partial", String.class); + String body = new TestRestTemplate() + .getForObject("http://localhost:" + this.port + "/partial", String.class); assertTrue(body.contains("Hello World")); } @@ -135,9 +135,9 @@ public class MustacheWebIntegrationTests { MustacheViewResolver resolver = new MustacheViewResolver(); resolver.setPrefix("classpath:/mustache-templates/"); resolver.setSuffix(".html"); - resolver.setCompiler(Mustache.compiler().withLoader( - new MustacheResourceTemplateLoader("classpath:/mustache-templates/", - ".html"))); + resolver.setCompiler( + Mustache.compiler().withLoader(new MustacheResourceTemplateLoader( + "classpath:/mustache-templates/", ".html"))); return resolver; } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java index b7f0434f29d..06a0fc7fa33 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java @@ -64,8 +64,8 @@ public class CustomHibernateJpaAutoConfigurationTests { this.context.refresh(); JpaProperties bean = this.context.getBean(JpaProperties.class); DataSource dataSource = this.context.getBean(DataSource.class); - String actual = bean.getHibernateProperties(dataSource).get( - "hibernate.hbm2ddl.auto"); + String actual = bean.getHibernateProperties(dataSource) + .get("hibernate.hbm2ddl.auto"); // Default is generic and safe assertThat(actual, nullValue()); } @@ -81,8 +81,8 @@ public class CustomHibernateJpaAutoConfigurationTests { this.context.refresh(); JpaProperties bean = this.context.getBean(JpaProperties.class); DataSource dataSource = this.context.getBean(DataSource.class); - String actual = bean.getHibernateProperties(dataSource).get( - "hibernate.hbm2ddl.auto"); + String actual = bean.getHibernateProperties(dataSource) + .get("hibernate.hbm2ddl.auto"); assertThat(actual, equalTo("create-drop")); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilderTests.java index 137ce589da5..a6a0fa270bc 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilderTests.java @@ -61,8 +61,8 @@ public class EntityManagerFactoryBuilderTests { .dataSource(this.dataSource1) .properties(Collections.singletonMap("foo", "spam")).build(); assertFalse(result1.getJpaPropertyMap().isEmpty()); - LocalContainerEntityManagerFactoryBean result2 = factory.dataSource( - this.dataSource2).build(); + LocalContainerEntityManagerFactoryBean result2 = factory + .dataSource(this.dataSource2).build(); assertTrue(result2.getJpaPropertyMap().isEmpty()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java index a8c40452cc7..dd4a50824db 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java @@ -49,32 +49,32 @@ public class SecurityPropertiesTests { @Test public void testBindingIgnoredSingleValued() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.ignored", "/css/**"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.ignored", "/css/**"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals(1, this.security.getIgnored().size()); } @Test public void testBindingIgnoredEmpty() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.ignored", ""))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.ignored", ""))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals(0, this.security.getIgnored().size()); } @Test public void testBindingIgnoredDisable() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.ignored", "none"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.ignored", "none"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals(1, this.security.getIgnored().size()); } @Test public void testBindingIgnoredMultiValued() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.ignored", "/css/**,/images/**"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.ignored", "/css/**,/images/**"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals(2, this.security.getIgnored().size()); } @@ -92,32 +92,32 @@ public class SecurityPropertiesTests { @Test public void testDefaultPasswordAutogeneratedIfUnresolovedPlaceholder() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.user.password", "${ADMIN_PASSWORD}"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.user.password", "${ADMIN_PASSWORD}"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertTrue(this.security.getUser().isDefaultPassword()); } @Test public void testDefaultPasswordAutogeneratedIfEmpty() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.user.password", ""))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.user.password", ""))); assertFalse(this.binder.getBindingResult().hasErrors()); assertTrue(this.security.getUser().isDefaultPassword()); } @Test public void testRoles() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.user.role", "USER,ADMIN"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.user.role", "USER,ADMIN"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals("[USER, ADMIN]", this.security.getUser().getRole().toString()); } @Test public void testRole() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.user.role", "ADMIN"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.user.role", "ADMIN"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals("[ADMIN]", this.security.getUser().getRole().toString()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java index 5610ae36834..84a0b875f56 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java @@ -190,8 +190,8 @@ public class ThymeleafAutoConfigurationTests { assertEquals(0, context.getBeanNamesForType(ViewResolver.class).length); try { TemplateEngine engine = context.getBean(TemplateEngine.class); - Context attrs = new Context(Locale.UK, Collections.singletonMap("greeting", - "Hello World")); + Context attrs = new Context(Locale.UK, + Collections.singletonMap("greeting", "Hello World")); String result = engine.process("message", attrs); assertThat(result, containsString("Hello World")); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProviderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProviderTests.java index 5668b1e8ba0..4e3c5e6faba 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProviderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProviderTests.java @@ -40,8 +40,8 @@ public class ThymeleafTemplateAvailabilityProviderTests { @Test public void availabilityOfTemplateInDefaultLocation() { - assertTrue(this.provider.isTemplateAvailable("home", this.environment, getClass() - .getClassLoader(), this.resourceLoader)); + assertTrue(this.provider.isTemplateAvailable("home", this.environment, + getClass().getClassLoader(), this.resourceLoader)); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java index a4d89f77858..30c63533022 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java @@ -109,8 +109,8 @@ public class JtaAutoConfigurationTests { this.context.refresh(); assertEquals(0, this.context.getBeansOfType(JtaTransactionManager.class).size()); assertEquals(0, this.context.getBeansOfType(XADataSourceWrapper.class).size()); - assertEquals(0, this.context.getBeansOfType(XAConnectionFactoryWrapper.class) - .size()); + assertEquals(0, + this.context.getBeansOfType(XAConnectionFactoryWrapper.class).size()); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProviderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProviderTests.java index 70696072c88..ab3b3444608 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProviderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProviderTests.java @@ -40,8 +40,8 @@ public class VelocityTemplateAvailabilityProviderTests { @Test public void availabilityOfTemplateInDefaultLocation() { - assertTrue(this.provider.isTemplateAvailable("home", this.environment, getClass() - .getClassLoader(), this.resourceLoader)); + assertTrue(this.provider.isTemplateAvailable("home", this.environment, + getClass().getClassLoader(), this.resourceLoader)); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java index e6c0c642579..407596fac8b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java @@ -56,16 +56,16 @@ public class DefaultErrorAttributesTests { @Test public void includeTimeStamp() throws Exception { - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("timestamp"), instanceOf(Date.class)); } @Test public void specificStatusCode() throws Exception { this.request.setAttribute("javax.servlet.error.status_code", 404); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("error"), equalTo((Object) HttpStatus.NOT_FOUND.getReasonPhrase())); assertThat(attributes.get("status"), equalTo((Object) 404)); @@ -73,8 +73,8 @@ public class DefaultErrorAttributesTests { @Test public void missingStatusCode() throws Exception { - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("error"), equalTo((Object) "None")); assertThat(attributes.get("status"), equalTo((Object) 999)); } @@ -84,10 +84,10 @@ public class DefaultErrorAttributesTests { RuntimeException ex = new RuntimeException("Test"); ModelAndView modelAndView = this.errorAttributes.resolveException(this.request, null, null, ex); - this.request.setAttribute("javax.servlet.error.exception", new RuntimeException( - "Ignored")); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + this.request.setAttribute("javax.servlet.error.exception", + new RuntimeException("Ignored")); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(this.errorAttributes.getError(this.requestAttributes), sameInstance((Object) ex)); assertThat(modelAndView, nullValue()); @@ -100,8 +100,8 @@ public class DefaultErrorAttributesTests { public void servletError() throws Exception { RuntimeException ex = new RuntimeException("Test"); this.request.setAttribute("javax.servlet.error.exception", ex); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(this.errorAttributes.getError(this.requestAttributes), sameInstance((Object) ex)); assertThat(attributes.get("exception"), @@ -112,19 +112,19 @@ public class DefaultErrorAttributesTests { @Test public void servletMessage() throws Exception { this.request.setAttribute("javax.servlet.error.message", "Test"); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("exception"), nullValue()); assertThat(attributes.get("message"), equalTo((Object) "Test")); } @Test public void nullMessage() throws Exception { - this.request - .setAttribute("javax.servlet.error.exception", new RuntimeException()); + this.request.setAttribute("javax.servlet.error.exception", + new RuntimeException()); this.request.setAttribute("javax.servlet.error.message", "Test"); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("exception"), equalTo((Object) RuntimeException.class.getName())); assertThat(attributes.get("message"), equalTo((Object) "Test")); @@ -135,8 +135,8 @@ public class DefaultErrorAttributesTests { RuntimeException ex = new RuntimeException("Test"); ServletException wrapped = new ServletException(new ServletException(ex)); this.request.setAttribute("javax.servlet.error.exception", wrapped); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(this.errorAttributes.getError(this.requestAttributes), sameInstance((Object) wrapped)); assertThat(attributes.get("exception"), @@ -148,8 +148,8 @@ public class DefaultErrorAttributesTests { public void getError() throws Exception { Error error = new OutOfMemoryError("Test error"); this.request.setAttribute("javax.servlet.error.exception", error); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(this.errorAttributes.getError(this.requestAttributes), sameInstance((Object) error)); assertThat(attributes.get("exception"), @@ -159,13 +159,13 @@ public class DefaultErrorAttributesTests { @Test public void extractBindingResultErrors() throws Exception { - BindingResult bindingResult = new MapBindingResult(Collections.singletonMap("a", - "b"), "objectName"); + BindingResult bindingResult = new MapBindingResult( + Collections.singletonMap("a", "b"), "objectName"); bindingResult.addError(new ObjectError("c", "d")); BindException ex = new BindException(bindingResult); this.request.setAttribute("javax.servlet.error.exception", ex); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("message"), equalTo((Object) ("Validation failed for " + "object='objectName'. Error count: 1"))); assertThat(attributes.get("errors"), @@ -176,8 +176,8 @@ public class DefaultErrorAttributesTests { public void trace() throws Exception { RuntimeException ex = new RuntimeException("Test"); this.request.setAttribute("javax.servlet.error.exception", ex); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, true); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, true); assertThat(attributes.get("trace").toString(), startsWith("java.lang")); } @@ -185,16 +185,16 @@ public class DefaultErrorAttributesTests { public void noTrace() throws Exception { RuntimeException ex = new RuntimeException("Test"); this.request.setAttribute("javax.servlet.error.exception", ex); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("trace"), nullValue()); } @Test public void path() throws Exception { this.request.setAttribute("javax.servlet.error.request_uri", "path"); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("path"), equalTo((Object) "path")); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java index 57a328dea24..24b8004fb2a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java @@ -241,8 +241,8 @@ public class EmbeddedServletContainerAutoConfigurationTests { } @Component - public static class CallbackEmbeddedContainerCustomizer implements - EmbeddedServletContainerCustomizer { + public static class CallbackEmbeddedContainerCustomizer + implements EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { container.setPort(9000); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java index 7ed483cd8b1..fd4f97cd170 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java @@ -75,8 +75,8 @@ public class EmbeddedServletContainerServletContextListenerTests { private void servletContextListenerBeanIsCalled(Class configuration) { AnnotationConfigEmbeddedWebApplicationContext context = new AnnotationConfigEmbeddedWebApplicationContext( ServletContextListenerBeanConfiguration.class, configuration); - ServletContextListener servletContextListener = context.getBean( - "servletContextListener", ServletContextListener.class); + ServletContextListener servletContextListener = context + .getBean("servletContextListener", ServletContextListener.class); verify(servletContextListener).contextInitialized(any(ServletContextEvent.class)); context.close(); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java index a261dc243eb..a63cf41c985 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java @@ -96,8 +96,8 @@ public class HttpEncodingAutoConfigurationTests { @Test public void filterIsOrderedHighest() throws Exception { load(OrderedConfiguration.class); - List beans = new ArrayList(this.context.getBeansOfType( - Filter.class).values()); + List beans = new ArrayList( + this.context.getBeansOfType(Filter.class).values()); AnnotationAwareOrderComparator.sort(beans); assertThat(beans.get(0), instanceOf(CharacterEncodingFilter.class)); assertThat(beans.get(1), instanceOf(HiddenHttpMethodFilter.class)); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java index 64e4c78d3c2..d341cc2241c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java @@ -75,8 +75,8 @@ public class HttpMessageConvertersAutoConfigurationTests { assertTrue(this.context.getBeansOfType(ObjectMapper.class).isEmpty()); assertTrue(this.context.getBeansOfType(MappingJackson2HttpMessageConverter.class) .isEmpty()); - assertTrue(this.context.getBeansOfType( - MappingJackson2XmlHttpMessageConverter.class).isEmpty()); + assertTrue(this.context + .getBeansOfType(MappingJackson2XmlHttpMessageConverter.class).isEmpty()); } @Test @@ -88,7 +88,8 @@ public class HttpMessageConvertersAutoConfigurationTests { assertConverterBeanExists(MappingJackson2HttpMessageConverter.class, "mappingJackson2HttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(MappingJackson2HttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + MappingJackson2HttpMessageConverter.class); } @Test @@ -102,8 +103,10 @@ public class HttpMessageConvertersAutoConfigurationTests { assertConverterBeanExists(MappingJackson2XmlHttpMessageConverter.class, "mappingJackson2XmlHttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(MappingJackson2HttpMessageConverter.class); - assertConverterBeanRegisteredWithHttpMessageConverters(MappingJackson2XmlHttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + MappingJackson2HttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + MappingJackson2XmlHttpMessageConverter.class); } @Test @@ -133,36 +136,36 @@ public class HttpMessageConvertersAutoConfigurationTests { assertConverterBeanExists(GsonHttpMessageConverter.class, "gsonHttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(GsonHttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + GsonHttpMessageConverter.class); } @Test public void jacksonIsPreferredByDefaultWhenBothGsonAndJacksonAreAvailable() { - this.context.register(GsonAutoConfiguration.class, - JacksonAutoConfiguration.class, + this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class); this.context.refresh(); assertConverterBeanExists(MappingJackson2HttpMessageConverter.class, "mappingJackson2HttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(MappingJackson2HttpMessageConverter.class); - assertEquals(0, this.context.getBeansOfType(GsonHttpMessageConverter.class) - .size()); + assertConverterBeanRegisteredWithHttpMessageConverters( + MappingJackson2HttpMessageConverter.class); + assertEquals(0, + this.context.getBeansOfType(GsonHttpMessageConverter.class).size()); } @Test public void gsonCanBePreferredWhenBothGsonAndJacksonAreAvailable() { - this.context.register(GsonAutoConfiguration.class, - JacksonAutoConfiguration.class, + this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "spring.http.converters.preferred-json-mapper:gson"); this.context.refresh(); assertConverterBeanExists(GsonHttpMessageConverter.class, "gsonHttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(GsonHttpMessageConverter.class); - assertEquals(0, - this.context.getBeansOfType(MappingJackson2HttpMessageConverter.class) - .size()); + assertConverterBeanRegisteredWithHttpMessageConverters( + GsonHttpMessageConverter.class); + assertEquals(0, this.context + .getBeansOfType(MappingJackson2HttpMessageConverter.class).size()); } @Test @@ -173,7 +176,8 @@ public class HttpMessageConvertersAutoConfigurationTests { assertConverterBeanExists(GsonHttpMessageConverter.class, "customGsonMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(GsonHttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + GsonHttpMessageConverter.class); } @Test @@ -182,7 +186,8 @@ public class HttpMessageConvertersAutoConfigurationTests { this.context.refresh(); assertConverterBeanExists(StringHttpMessageConverter.class, "stringHttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(StringHttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + StringHttpMessageConverter.class); } @Test @@ -193,7 +198,8 @@ public class HttpMessageConvertersAutoConfigurationTests { assertConverterBeanExists(StringHttpMessageConverter.class, "customStringMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(StringHttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + StringHttpMessageConverter.class); } @Test @@ -206,9 +212,8 @@ public class HttpMessageConvertersAutoConfigurationTests { BeanDefinition beanDefinition = this.context .getBeanDefinition("mappingJackson2HttpMessageConverter"); - assertThat(beanDefinition.getFactoryBeanName(), - is(equalTo(MappingJackson2HttpMessageConverterConfiguration.class - .getName()))); + assertThat(beanDefinition.getFactoryBeanName(), is(equalTo( + MappingJackson2HttpMessageConverterConfiguration.class.getName()))); } @Test @@ -224,9 +229,8 @@ public class HttpMessageConvertersAutoConfigurationTests { System.out.println(beansOfType); BeanDefinition beanDefinition = this.context .getBeanDefinition("mappingJackson2HttpMessageConverter"); - assertThat(beanDefinition.getFactoryBeanName(), - is(equalTo(MappingJackson2HttpMessageConverterConfiguration.class - .getName()))); + assertThat(beanDefinition.getFactoryBeanName(), is(equalTo( + MappingJackson2HttpMessageConverterConfiguration.class.getName()))); } private void assertConverterBeanExists(Class type, String beanName) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java index 0f3a5937bd3..57c29fbb6a6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java @@ -58,12 +58,14 @@ public class HttpMessageConvertersTests { for (HttpMessageConverter converter : converters) { converterClasses.add(converter.getClass()); } - assertThat(converterClasses, equalTo(Arrays.>asList( - ByteArrayHttpMessageConverter.class, StringHttpMessageConverter.class, - ResourceHttpMessageConverter.class, SourceHttpMessageConverter.class, - AllEncompassingFormHttpMessageConverter.class, - MappingJackson2HttpMessageConverter.class, - MappingJackson2XmlHttpMessageConverter.class))); + assertThat(converterClasses, + equalTo(Arrays.>asList(ByteArrayHttpMessageConverter.class, + StringHttpMessageConverter.class, + ResourceHttpMessageConverter.class, + SourceHttpMessageConverter.class, + AllEncompassingFormHttpMessageConverter.class, + MappingJackson2HttpMessageConverter.class, + MappingJackson2XmlHttpMessageConverter.class))); } @Test @@ -104,9 +106,10 @@ public class HttpMessageConvertersTests { @Override protected List> postProcessConverters( List> converters) { - for (Iterator> iterator = converters.iterator(); iterator - .hasNext();) { - if (iterator.next() instanceof MappingJackson2XmlHttpMessageConverter) { + for (Iterator> iterator = converters + .iterator(); iterator.hasNext();) { + if (iterator + .next() instanceof MappingJackson2XmlHttpMessageConverter) { iterator.remove(); } } @@ -117,11 +120,13 @@ public class HttpMessageConvertersTests { for (HttpMessageConverter converter : converters) { converterClasses.add(converter.getClass()); } - assertThat(converterClasses, equalTo(Arrays.>asList( - ByteArrayHttpMessageConverter.class, StringHttpMessageConverter.class, - ResourceHttpMessageConverter.class, SourceHttpMessageConverter.class, - AllEncompassingFormHttpMessageConverter.class, - MappingJackson2HttpMessageConverter.class))); + assertThat(converterClasses, + equalTo(Arrays.>asList(ByteArrayHttpMessageConverter.class, + StringHttpMessageConverter.class, + ResourceHttpMessageConverter.class, + SourceHttpMessageConverter.class, + AllEncompassingFormHttpMessageConverter.class, + MappingJackson2HttpMessageConverter.class))); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java index 54fe9b7e8dd..e9b2f4f2b76 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java @@ -188,8 +188,8 @@ public class MultipartAutoConfigurationTests { BaseConfiguration.class); this.context.refresh(); this.context.getBean(MultipartProperties.class); - assertEquals(expectedNumberOfMultipartConfigElementBeans, this.context - .getBeansOfType(MultipartConfigElement.class).size()); + assertEquals(expectedNumberOfMultipartConfigElementBeans, + this.context.getBeansOfType(MultipartConfigElement.class).size()); } @Test @@ -204,8 +204,8 @@ public class MultipartAutoConfigurationTests { private void verify404() throws Exception { HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); - ClientHttpRequest request = requestFactory.createRequest(new URI( - "http://localhost:" + ClientHttpRequest request = requestFactory.createRequest( + new URI("http://localhost:" + this.context.getEmbeddedServletContainer().getPort() + "/"), HttpMethod.GET); ClientHttpResponse response = request.execute(); @@ -214,9 +214,12 @@ public class MultipartAutoConfigurationTests { private void verifyServletWorks() { RestTemplate restTemplate = new RestTemplate(); - assertEquals("Hello", restTemplate.getForObject("http://localhost:" - + this.context.getEmbeddedServletContainer().getPort() + "/", - String.class)); + assertEquals("Hello", + restTemplate + .getForObject( + "http://localhost:" + this.context + .getEmbeddedServletContainer().getPort() + "/", + String.class)); } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java index 5cc6ea452bf..2b79bdf61a5 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java @@ -56,16 +56,16 @@ public class RemappedErrorViewIntegrationTests { @Test public void directAccessToErrorPage() throws Exception { - String content = this.template.getForObject("http://localhost:" + this.port - + "/spring/error", String.class); + String content = this.template.getForObject( + "http://localhost:" + this.port + "/spring/error", String.class); assertTrue("Wrong content: " + content, content.contains("error")); assertTrue("Wrong content: " + content, content.contains("999")); } @Test public void forwardToErrorPage() throws Exception { - String content = this.template.getForObject("http://localhost:" + this.port - + "/spring/", String.class); + String content = this.template + .getForObject("http://localhost:" + this.port + "/spring/", String.class); assertTrue("Wrong content: " + content, content.contains("error")); assertTrue("Wrong content: " + content, content.contains("500")); } @@ -91,8 +91,8 @@ public class RemappedErrorViewIntegrationTests { // For manual testing public static void main(String[] args) { - new SpringApplicationBuilder(TestConfiguration.class).properties( - "server.servletPath:spring/*").run(args); + new SpringApplicationBuilder(TestConfiguration.class) + .properties("server.servletPath:spring/*").run(args); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java index 2148f29f094..b884ff205bf 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java @@ -70,8 +70,8 @@ public class WebSocketAutoConfigurationTests { Class... configuration) { this.context.register(configuration); this.context.refresh(); - Object serverContainer = this.context.getServletContext().getAttribute( - "javax.websocket.server.ServerContainer"); + Object serverContainer = this.context.getServletContext() + .getAttribute("javax.websocket.server.ServerContainer"); assertThat(serverContainer, is(instanceOf(ServerContainer.class))); } diff --git a/spring-boot-cli/src/it/java/org/springframework/boot/cli/CommandLineIT.java b/spring-boot-cli/src/it/java/org/springframework/boot/cli/CommandLineIT.java index e5379ef2704..d0e3c97c465 100644 --- a/spring-boot-cli/src/it/java/org/springframework/boot/cli/CommandLineIT.java +++ b/spring-boot-cli/src/it/java/org/springframework/boot/cli/CommandLineIT.java @@ -38,8 +38,8 @@ public class CommandLineIT { private final CommandLineInvoker cli = new CommandLineInvoker(); @Test - public void hintProducesListOfValidCommands() throws IOException, - InterruptedException { + public void hintProducesListOfValidCommands() + throws IOException, InterruptedException { Invocation cli = this.cli.invoke("hint"); assertThat(cli.await(), equalTo(0)); assertThat("Unexpected error: \n" + cli.getErrorOutput(), cli.getErrorOutput() @@ -48,8 +48,8 @@ public class CommandLineIT { } @Test - public void invokingWithNoArgumentsDisplaysHelp() throws IOException, - InterruptedException { + public void invokingWithNoArgumentsDisplaysHelp() + throws IOException, InterruptedException { Invocation cli = this.cli.invoke(); assertThat(cli.await(), equalTo(1)); assertThat(cli.getErrorOutput().length(), equalTo(0)); @@ -57,8 +57,8 @@ public class CommandLineIT { } @Test - public void unrecognizedCommandsAreHandledGracefully() throws IOException, - InterruptedException { + public void unrecognizedCommandsAreHandledGracefully() + throws IOException, InterruptedException { Invocation cli = this.cli.invoke("not-a-real-command"); assertThat(cli.await(), equalTo(1)); assertThat(cli.getErrorOutput(), diff --git a/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java b/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java index cf1b508a792..62494e157e2 100644 --- a/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java +++ b/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java @@ -38,8 +38,8 @@ import static org.junit.Assert.assertTrue; */ public class JarCommandIT { - private final CommandLineInvoker cli = new CommandLineInvoker(new File( - "src/it/resources/jar-command")); + private final CommandLineInvoker cli = new CommandLineInvoker( + new File("src/it/resources/jar-command")); @Test public void noArguments() throws Exception { @@ -68,11 +68,12 @@ public class JarCommandIT { assertThat(invocation.getErrorOutput(), equalTo("")); invocation = this.cli.invoke("jar", jar.getAbsolutePath(), "bad.groovy"); invocation.await(); - assertEquals(invocation.getErrorOutput(), 0, invocation.getErrorOutput().length()); + assertEquals(invocation.getErrorOutput(), 0, + invocation.getErrorOutput().length()); assertTrue(jar.exists()); - Process process = new JavaExecutable().processBuilder("-jar", - jar.getAbsolutePath()).start(); + Process process = new JavaExecutable() + .processBuilder("-jar", jar.getAbsolutePath()).start(); invocation = new Invocation(process); invocation.await(); @@ -85,11 +86,12 @@ public class JarCommandIT { Invocation invocation = this.cli.invoke("jar", jar.getAbsolutePath(), "jar.groovy"); invocation.await(); - assertEquals(invocation.getErrorOutput(), 0, invocation.getErrorOutput().length()); + assertEquals(invocation.getErrorOutput(), 0, + invocation.getErrorOutput().length()); assertTrue(jar.exists()); - Process process = new JavaExecutable().processBuilder("-jar", - jar.getAbsolutePath()).start(); + Process process = new JavaExecutable() + .processBuilder("-jar", jar.getAbsolutePath()).start(); invocation = new Invocation(process); invocation.await(); @@ -107,14 +109,15 @@ public class JarCommandIT { @Test public void jarCreationWithIncludes() throws Exception { File jar = new File("target/test-app.jar"); - Invocation invocation = this.cli.invoke("jar", jar.getAbsolutePath(), - "--include", "-public/**,-resources/**", "jar.groovy"); + Invocation invocation = this.cli.invoke("jar", jar.getAbsolutePath(), "--include", + "-public/**,-resources/**", "jar.groovy"); invocation.await(); - assertEquals(invocation.getErrorOutput(), 0, invocation.getErrorOutput().length()); + assertEquals(invocation.getErrorOutput(), 0, + invocation.getErrorOutput().length()); assertTrue(jar.exists()); - Process process = new JavaExecutable().processBuilder("-jar", - jar.getAbsolutePath()).start(); + Process process = new JavaExecutable() + .processBuilder("-jar", jar.getAbsolutePath()).start(); invocation = new Invocation(process); invocation.await(); diff --git a/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java b/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java index 9f4f28e62cf..a946e12d798 100644 --- a/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java +++ b/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java @@ -71,8 +71,8 @@ public final class CommandLineInvoker { return pathname.isDirectory() && pathname.getName().contains("-bin"); } })[0]; - dir = new File(dir, dir.getName().replace("-bin", "") - .replace("spring-boot-cli", "spring")); + dir = new File(dir, + dir.getName().replace("-bin", "").replace("spring-boot-cli", "spring")); dir = new File(dir, "bin"); File launchScript = new File(dir, isWindows() ? "spring.bat" : "spring"); Assert.state(launchScript.exists() && launchScript.isFile(), @@ -99,10 +99,10 @@ public final class CommandLineInvoker { public Invocation(Process process) { this.process = process; - this.streamReaders.add(new Thread(new StreamReadingRunnable(this.process - .getErrorStream(), this.err))); - this.streamReaders.add(new Thread(new StreamReadingRunnable(this.process - .getInputStream(), this.out))); + this.streamReaders.add(new Thread( + new StreamReadingRunnable(this.process.getErrorStream(), this.err))); + this.streamReaders.add(new Thread( + new StreamReadingRunnable(this.process.getInputStream(), this.out))); for (Thread streamReader : this.streamReaders) { streamReader.start(); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java index d938fee9087..dbbb7fb758a 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java @@ -59,8 +59,8 @@ public final class SpringCli { } private static void addServiceLoaderCommands(CommandRunner runner) { - ServiceLoader factories = ServiceLoader.load( - CommandFactory.class, runner.getClass().getClassLoader()); + ServiceLoader factories = ServiceLoader.load(CommandFactory.class, + runner.getClass().getClassLoader()); for (CommandFactory factory : factories) { runner.addCommands(factory.getCommands()); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java index a654d748aef..1d52afd8b14 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java @@ -148,8 +148,8 @@ public class CommandRunner implements Iterable { public Command findCommand(String name) { for (Command candidate : this.commands) { String candidateName = candidate.getName(); - if (candidateName.equals(name) - || (isOptionCommand(candidate) && ("--" + candidateName).equals(name))) { + if (candidateName.equals(name) || (isOptionCommand(candidate) + && ("--" + candidateName).equals(name))) { return candidate; } } @@ -280,8 +280,8 @@ public class CommandRunner implements Iterable { String usageHelp = command.getUsageHelp(); String description = command.getDescription(); Log.info(String.format("\n %1$s %2$-15s\n %3$s", command.getName(), - (usageHelp == null ? "" : usageHelp), (description == null ? "" - : description))); + (usageHelp == null ? "" : usageHelp), + (description == null ? "" : description))); } } Log.info(""); 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 b48884d0eb2..5e1a8abc92e 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 @@ -33,7 +33,8 @@ public abstract class OptionParsingCommand extends AbstractCommand { private final OptionHandler handler; - protected OptionParsingCommand(String name, String description, OptionHandler handler) { + protected OptionParsingCommand(String name, String description, + OptionHandler handler) { super(name, description); this.handler = handler; } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java index 3b763931aa5..8126edc0052 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java @@ -83,8 +83,8 @@ public class HintCommand extends AbstractCommand { return false; } return command.getName().startsWith(starting) - || (this.commandRunner.isOptionCommand(command) && ("--" + command - .getName()).startsWith(starting)); + || (this.commandRunner.isOptionCommand(command) + && ("--" + command.getName()).startsWith(starting)); } private void showCommandOptionHints(String commandName, diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java index 5e90e1e94fd..87562d368a1 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java @@ -104,7 +104,8 @@ class InitializrService { * @throws IOException if the service's metadata cannot be loaded */ public InitializrServiceMetadata loadMetadata(String serviceUrl) throws IOException { - CloseableHttpResponse httpResponse = executeInitializrMetadataRetrieval(serviceUrl); + CloseableHttpResponse httpResponse = executeInitializrMetadataRetrieval( + serviceUrl); validateResponse(httpResponse, serviceUrl); return parseJsonMetadata(httpResponse.getEntity()); } @@ -120,8 +121,10 @@ class InitializrService { */ public Object loadServiceCapabilities(String serviceUrl) throws IOException { HttpGet request = new HttpGet(serviceUrl); - request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_SERVICE_CAPABILITIES)); - CloseableHttpResponse httpResponse = execute(request, serviceUrl, "retrieve help"); + request.setHeader( + new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_SERVICE_CAPABILITIES)); + CloseableHttpResponse httpResponse = execute(request, serviceUrl, + "retrieve help"); validateResponse(httpResponse, serviceUrl); HttpEntity httpEntity = httpResponse.getEntity(); ContentType contentType = ContentType.getOrDefault(httpEntity); @@ -137,15 +140,15 @@ class InitializrService { return new InitializrServiceMetadata(getContentAsJson(httpEntity)); } catch (JSONException ex) { - throw new ReportableException("Invalid content received from server (" - + ex.getMessage() + ")", ex); + throw new ReportableException( + "Invalid content received from server (" + ex.getMessage() + ")", ex); } } private void validateResponse(CloseableHttpResponse httpResponse, String serviceUrl) { if (httpResponse.getEntity() == null) { - throw new ReportableException("No content received from server '" - + serviceUrl + "'"); + throw new ReportableException( + "No content received from server '" + serviceUrl + "'"); } if (httpResponse.getStatusLine().getStatusCode() != 200) { throw createException(serviceUrl, httpResponse); @@ -157,8 +160,8 @@ class InitializrService { ProjectGenerationResponse response = new ProjectGenerationResponse( ContentType.getOrDefault(httpEntity)); response.setContent(FileCopyUtils.copyToByteArray(httpEntity.getContent())); - String fileName = extractFileName(httpResponse - .getFirstHeader("Content-Disposition")); + String fileName = extractFileName( + httpResponse.getFirstHeader("Content-Disposition")); if (fileName != null) { response.setFileName(fileName); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java index c747ead0965..898269570dc 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java @@ -68,8 +68,8 @@ class InitializrServiceMetadata { InitializrServiceMetadata(ProjectType defaultProjectType) { this.dependencies = new HashMap(); this.projectTypes = new MetadataHolder(); - this.projectTypes.getContent() - .put(defaultProjectType.getId(), defaultProjectType); + this.projectTypes.getContent().put(defaultProjectType.getId(), + defaultProjectType); this.projectTypes.setDefaultItem(defaultProjectType); this.defaults = new HashMap(); } @@ -145,8 +145,8 @@ class InitializrServiceMetadata { } JSONObject type = root.getJSONObject(TYPE_EL); JSONArray array = type.getJSONArray(VALUES_EL); - String defaultType = type.has(DEFAULT_ATTRIBUTE) ? type - .getString(DEFAULT_ATTRIBUTE) : null; + String defaultType = type.has(DEFAULT_ATTRIBUTE) + ? type.getString(DEFAULT_ATTRIBUTE) : null; for (int i = 0; i < array.length(); i++) { JSONObject typeJson = array.getJSONObject(i); ProjectType projectType = parseType(typeJson, defaultType); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java index 5710116b493..7ea8bc2e5dd 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java @@ -367,8 +367,8 @@ class ProjectGenerationRequest { if (this.type != null) { ProjectType result = metadata.getProjectTypes().get(this.type); if (result == null) { - throw new ReportableException( - ("No project type with id '" + this.type + "' - check the service capabilities (--list)")); + throw new ReportableException(("No project type with id '" + this.type + + "' - check the service capabilities (--list)")); } return result; } @@ -423,8 +423,8 @@ class ProjectGenerationRequest { private static void filter(Map projects, String tag, String tagValue) { - for (Iterator> it = projects.entrySet().iterator(); it - .hasNext();) { + for (Iterator> it = projects.entrySet() + .iterator(); it.hasNext();) { Map.Entry entry = it.next(); String value = entry.getValue().getTags().get(tag); if (!tagValue.equals(value)) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java index ee9a040836b..fd71c0373e5 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java @@ -46,8 +46,8 @@ class ProjectGenerator { public void generateProject(ProjectGenerationRequest request, boolean force) throws IOException { ProjectGenerationResponse response = this.initializrService.generate(request); - String fileName = (request.getOutput() != null ? request.getOutput() : response - .getFileName()); + String fileName = (request.getOutput() != null ? request.getOutput() + : response.getFileName()); if (shouldExtract(request, response)) { if (isZipArchive(response)) { extractProject(response, request.getOutput(), force); @@ -101,13 +101,13 @@ class ProjectGenerator { private void extractProject(ProjectGenerationResponse entity, String output, boolean overwrite) throws IOException { - File outputFolder = (output != null ? new File(output) : new File( - System.getProperty("user.dir"))); + File outputFolder = (output != null ? new File(output) + : new File(System.getProperty("user.dir"))); if (!outputFolder.exists()) { outputFolder.mkdirs(); } - ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream( - entity.getContent())); + ZipInputStream zipStream = new ZipInputStream( + new ByteArrayInputStream(entity.getContent())); try { extractFromStream(zipStream, overwrite, outputFolder); Log.info("Project extracted to '" + outputFolder.getAbsolutePath() + "'"); @@ -150,8 +150,8 @@ class ProjectGenerator { + "overwrite or specify an alternate location."); } if (!outputFile.delete()) { - throw new ReportableException("Failed to delete existing file " - + outputFile.getPath()); + throw new ReportableException( + "Failed to delete existing file " + outputFile.getPath()); } } FileCopyUtils.copy(entity.getContent(), outputFile); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java index b3c2ce48995..85acae36e1c 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java @@ -133,10 +133,12 @@ class ServiceCapabilitiesReportGenerator { report.append("]"); } - private void reportDefaults(StringBuilder report, InitializrServiceMetadata metadata) { + private void reportDefaults(StringBuilder report, + InitializrServiceMetadata metadata) { report.append("Defaults:" + NEW_LINE); report.append("---------" + NEW_LINE); - List defaultsKeys = new ArrayList(metadata.getDefaults().keySet()); + List defaultsKeys = new ArrayList( + metadata.getDefaults().keySet()); Collections.sort(defaultsKeys); for (String defaultsKey : defaultsKeys) { String defaultsValue = metadata.getDefaults().get(defaultsKey); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java index e32396b19ed..e0757630d60 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java @@ -48,8 +48,8 @@ class Installer { Installer(OptionSet options, CompilerOptionHandler compilerOptionHandler) throws IOException { - this(new GroovyGrabDependencyResolver(createCompilerConfiguration(options, - compilerOptionHandler))); + this(new GroovyGrabDependencyResolver( + createCompilerConfiguration(options, compilerOptionHandler))); } Installer(DependencyResolver resolver) throws IOException { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/ResourceMatcher.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/ResourceMatcher.java index e0ccc1b170d..da08216c016 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/ResourceMatcher.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/ResourceMatcher.java @@ -187,8 +187,8 @@ class ResourceMatcher { } private MatchedResource(File rootFolder, File file) { - this.name = StringUtils.cleanPath(file.getAbsolutePath().substring( - rootFolder.getAbsolutePath().length() + 1)); + this.name = StringUtils.cleanPath(file.getAbsolutePath() + .substring(rootFolder.getAbsolutePath().length() + 1)); this.file = file; this.root = false; } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java index fa528794d35..6da5f169671 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java @@ -42,8 +42,8 @@ public class OptionSetGroovyCompilerConfiguration implements GroovyCompilerConfi protected OptionSetGroovyCompilerConfiguration(OptionSet optionSet, CompilerOptionHandler compilerOptionHandler) { - this(optionSet, compilerOptionHandler, RepositoryConfigurationFactory - .createDefaultRepositoryConfiguration()); + this(optionSet, compilerOptionHandler, + RepositoryConfigurationFactory.createDefaultRepositoryConfiguration()); } public OptionSetGroovyCompilerConfiguration(OptionSet optionSet, diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java index 0c1a03a4846..6c5d0897529 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java @@ -94,8 +94,8 @@ public class SourceOptions { } } } - this.args = Collections.unmodifiableList(nonOptionArguments.subList( - sourceArgCount, nonOptionArguments.size())); + this.args = Collections.unmodifiableList( + nonOptionArguments.subList(sourceArgCount, nonOptionArguments.size())); Assert.isTrue(sources.size() > 0, "Please specify at least one file"); this.sources = Collections.unmodifiableList(sources); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java index c826cbb30fa..35e0d423bde 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java @@ -96,8 +96,8 @@ public class RunCommand extends OptionParsingCommand { List repositoryConfiguration = RepositoryConfigurationFactory .createDefaultRepositoryConfiguration(); - repositoryConfiguration.add(0, new RepositoryConfiguration("local", new File( - "repository").toURI(), true)); + repositoryConfiguration.add(0, new RepositoryConfiguration("local", + new File("repository").toURI(), true)); SpringApplicationRunnerConfiguration configuration = new SpringApplicationRunnerConfigurationAdapter( options, this, repositoryConfiguration); @@ -113,9 +113,9 @@ public class RunCommand extends OptionParsingCommand { * Simple adapter class to present the {@link OptionSet} as a * {@link SpringApplicationRunnerConfiguration}. */ - private class SpringApplicationRunnerConfigurationAdapter extends - OptionSetGroovyCompilerConfiguration implements - SpringApplicationRunnerConfiguration { + private class SpringApplicationRunnerConfigurationAdapter + extends OptionSetGroovyCompilerConfiguration + implements SpringApplicationRunnerConfiguration { SpringApplicationRunnerConfigurationAdapter(OptionSet options, CompilerOptionHandler optionHandler, diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java index df60ce92576..8cca767f730 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java @@ -156,7 +156,7 @@ public class SpringApplicationRunner { try { this.applicationContext = new SpringApplicationLauncher( getContextClassLoader()).launch(this.compiledSources, - SpringApplicationRunner.this.args); + SpringApplicationRunner.this.args); } catch (Exception ex) { ex.printStackTrace(); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerConfiguration.java index 80e608502a8..354f38d28d3 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerConfiguration.java @@ -25,7 +25,8 @@ import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration; * * @author Phillip Webb */ -public interface SpringApplicationRunnerConfiguration extends GroovyCompilerConfiguration { +public interface SpringApplicationRunnerConfiguration + extends GroovyCompilerConfiguration { /** * Returns {@code true} if the source file should be monitored for changes and 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 3fa84bf7240..a1122dc8e35 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 @@ -61,8 +61,8 @@ public class CommandCompleter extends StringsCompleter { } AggregateCompleter arguementCompleters = new AggregateCompleter( new StringsCompleter(options), new FileNameCompleter()); - ArgumentCompleter argumentCompleter = new ArgumentCompleter( - argumentDelimiter, arguementCompleters); + ArgumentCompleter argumentCompleter = new ArgumentCompleter(argumentDelimiter, + arguementCompleters); argumentCompleter.setStrict(false); this.commandCompleters.put(command.getName(), argumentCompleter); } @@ -99,8 +99,8 @@ public class CommandCompleter extends StringsCompleter { for (OptionHelp optionHelp : command.getOptionsHelp()) { OptionHelpLine optionHelpLine = new OptionHelpLine(optionHelp); optionHelpLines.add(optionHelpLine); - maxOptionsLength = Math.max(maxOptionsLength, optionHelpLine.getOptions() - .length()); + maxOptionsLength = Math.max(maxOptionsLength, + optionHelpLine.getOptions().length()); } this.console.println(); 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 64f42cb915c..2cabd3cc3b1 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 @@ -49,6 +49,7 @@ import jline.console.completer.CandidateListCompletionHandler; public class Shell { private static final Set> NON_FORKED_COMMANDS; + static { Set> nonForked = new HashSet>(); nonForked.add(VersionCommand.class); @@ -86,8 +87,8 @@ public class Shell { private Iterable getCommands() { List commands = new ArrayList(); - ServiceLoader factories = ServiceLoader.load( - CommandFactory.class, getClass().getClassLoader()); + ServiceLoader factories = ServiceLoader.load(CommandFactory.class, + getClass().getClassLoader()); for (CommandFactory factory : factories) { for (Command command : factory.getCommands()) { commands.add(convertToForkCommand(command)); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java index cce321351c5..138b677caa3 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java @@ -95,7 +95,8 @@ public class TestRunner { if (sources.length != 0 && sources[0] instanceof Class) { setContextClassLoader(((Class) sources[0]).getClassLoader()); } - this.spockSpecificationClass = loadSpockSpecificationClass(getContextClassLoader()); + this.spockSpecificationClass = loadSpockSpecificationClass( + getContextClassLoader()); this.testClasses = getTestClasses(sources); } @@ -135,8 +136,8 @@ public class TestRunner { } private boolean isSpockTest(Class sourceClass) { - return (this.spockSpecificationClass != null && this.spockSpecificationClass - .isAssignableFrom(sourceClass)); + return (this.spockSpecificationClass != null + && this.spockSpecificationClass.isAssignableFrom(sourceClass)); } @Override @@ -156,8 +157,8 @@ public class TestRunner { resultClass); Object result = resultClass.newInstance(); runMethod.invoke(null, this.testClasses, result); - boolean wasSuccessful = (Boolean) resultClass.getMethod( - "wasSuccessful").invoke(result); + boolean wasSuccessful = (Boolean) resultClass + .getMethod("wasSuccessful").invoke(result); if (!wasSuccessful) { throw new RuntimeException("Tests Failed."); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java index df86fe1a91a..5a490b2ee74 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java @@ -79,8 +79,8 @@ public abstract class AstUtils { String... annotations) { for (AnnotationNode annotationNode : node.getAnnotations()) { for (String annotation : annotations) { - if (PatternMatchUtils.simpleMatch(annotation, annotationNode - .getClassNode().getName())) { + if (PatternMatchUtils.simpleMatch(annotation, + annotationNode.getClassNode().getName())) { return true; } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java index 47c7e3297db..3ce4f89d251 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java @@ -88,9 +88,9 @@ public abstract class CompilerAutoConfiguration { * @param classNode the class * @throws CompilationFailedException if the configuration cannot be applied */ - public void apply(GroovyClassLoader loader, - GroovyCompilerConfiguration configuration, GeneratorContext generatorContext, - SourceUnit source, ClassNode classNode) throws CompilationFailedException { + public void apply(GroovyClassLoader loader, GroovyCompilerConfiguration configuration, + GeneratorContext generatorContext, SourceUnit source, ClassNode classNode) + throws CompilationFailedException { } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java index deca66587cd..6b9b1fddbe9 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java @@ -74,8 +74,8 @@ public class DependencyCustomizer { } public String getVersion(String artifactId, String defaultVersion) { - String version = this.dependencyResolutionContext - .getArtifactCoordinatesResolver().getVersion(artifactId); + String version = this.dependencyResolutionContext.getArtifactCoordinatesResolver() + .getVersion(artifactId); if (version == null) { version = defaultVersion; } @@ -224,11 +224,11 @@ public class DependencyCustomizer { if (canAdd()) { ArtifactCoordinatesResolver artifactCoordinatesResolver = this.dependencyResolutionContext .getArtifactCoordinatesResolver(); - this.classNode.addAnnotation(createGrabAnnotation( - artifactCoordinatesResolver.getGroupId(module), - artifactCoordinatesResolver.getArtifactId(module), - artifactCoordinatesResolver.getVersion(module), classifier, type, - transitive)); + this.classNode.addAnnotation( + createGrabAnnotation(artifactCoordinatesResolver.getGroupId(module), + artifactCoordinatesResolver.getArtifactId(module), + artifactCoordinatesResolver.getVersion(module), classifier, + type, transitive)); } return this; } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java index d911d258d44..46325881550 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java @@ -160,8 +160,8 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader { @Override protected Class createClass(byte[] code, ClassNode classNode) { Class createdClass = super.createClass(code, classNode); - ExtendedGroovyClassLoader.this.classResources.put(classNode.getName() - .replace(".", "/") + ".class", code); + ExtendedGroovyClassLoader.this.classResources + .put(classNode.getName().replace(".", "/") + ".class", code); return createdClass; } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java index c35b1ab7d65..e4d7ddbe135 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java @@ -52,7 +52,8 @@ public class GroovyBeansTransformation implements ASTTransformation { for (ASTNode node : nodes) { if (node instanceof ModuleNode) { ModuleNode module = (ModuleNode) node; - for (ClassNode classNode : new ArrayList(module.getClasses())) { + for (ClassNode classNode : new ArrayList( + module.getClasses())) { if (classNode.isScript()) { classNode.visitContents(new ClassVisitor(source, classNode)); } @@ -95,9 +96,10 @@ public class GroovyBeansTransformation implements ASTTransformation { // Implement the interface by adding a public read-only property with the // same name as the method in the interface (getBeans). Make it return the // closure. - this.classNode.addProperty(new PropertyNode(BEANS, Modifier.PUBLIC - | Modifier.FINAL, ClassHelper.CLOSURE_TYPE - .getPlainNodeReference(), this.classNode, closure, null, null)); + this.classNode.addProperty( + new PropertyNode(BEANS, Modifier.PUBLIC | Modifier.FINAL, + ClassHelper.CLOSURE_TYPE.getPlainNodeReference(), + this.classNode, closure, null, null)); // Only do this once per class this.xformed = true; } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java index ba03583ab21..d6694f2f83b 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java @@ -38,8 +38,8 @@ import groovy.lang.Grab; * @author Phillip Webb */ @Order(ResolveDependencyCoordinatesTransformation.ORDER) -public class ResolveDependencyCoordinatesTransformation extends - AnnotatedNodeASTTransformation { +public class ResolveDependencyCoordinatesTransformation + extends AnnotatedNodeASTTransformation { /** * The order of the transformation. @@ -47,8 +47,8 @@ public class ResolveDependencyCoordinatesTransformation extends public static final int ORDER = DependencyManagementBomTransformation.ORDER + 300; private static final Set GRAB_ANNOTATION_NAMES = Collections - .unmodifiableSet(new HashSet(Arrays.asList(Grab.class.getName(), - Grab.class.getSimpleName()))); + .unmodifiableSet(new HashSet( + Arrays.asList(Grab.class.getName(), Grab.class.getSimpleName()))); private final DependencyResolutionContext resolutionContext; diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java index cb46cf6193b..45a1fd57610 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java @@ -39,8 +39,8 @@ class SmartImportCustomizer extends ImportCustomizer { @Override public ImportCustomizer addImport(String alias, String className) { - if (this.source.getAST().getImport( - ClassHelper.make(className).getNameWithoutPackage()) == null) { + if (this.source.getAST() + .getImport(ClassHelper.make(className).getNameWithoutPackage()) == null) { super.addImport(alias, className); } return this; @@ -49,8 +49,8 @@ class SmartImportCustomizer extends ImportCustomizer { @Override public ImportCustomizer addImports(String... imports) { for (String alias : imports) { - if (this.source.getAST().getImport( - ClassHelper.make(alias).getNameWithoutPackage()) == null) { + if (this.source.getAST() + .getImport(ClassHelper.make(alias).getNameWithoutPackage()) == null) { super.addImports(alias); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/GroovyTemplatesCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/GroovyTemplatesCompilerAutoConfiguration.java index 2193221665e..0a3aaeeb99d 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/GroovyTemplatesCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/GroovyTemplatesCompilerAutoConfiguration.java @@ -39,8 +39,8 @@ public class GroovyTemplatesCompilerAutoConfiguration extends CompilerAutoConfig @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses("groovy.text.TemplateEngine").add( - "groovy-templates"); + dependencies.ifAnyMissingClasses("groovy.text.TemplateEngine") + .add("groovy-templates"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java index 77d6c9f7a74..b373c82047f 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java @@ -37,16 +37,15 @@ public class SpringBatchCompilerAutoConfiguration extends CompilerAutoConfigurat @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses("org.springframework.batch.core.Job").add( - "spring-boot-starter-batch"); + dependencies.ifAnyMissingClasses("org.springframework.batch.core.Job") + .add("spring-boot-starter-batch"); dependencies.ifAnyMissingClasses("org.springframework.jdbc.core.JdbcTemplate") .add("spring-jdbc"); } @Override public void applyImports(ImportCustomizer imports) { - imports.addImports( - "org.springframework.batch.repeat.RepeatStatus", + imports.addImports("org.springframework.batch.repeat.RepeatStatus", "org.springframework.batch.core.scope.context.ChunkContext", "org.springframework.batch.core.step.tasklet.Tasklet", "org.springframework.batch.core.configuration.annotation.StepScope", diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java index fe1ddb8434e..0a2553007ea 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java @@ -45,10 +45,8 @@ public class SpringBootCompilerAutoConfiguration extends CompilerAutoConfigurati @Override public void applyImports(ImportCustomizer imports) { - imports.addImports( - "javax.annotation.PostConstruct", - "javax.annotation.PreDestroy", - "groovy.util.logging.Log", + imports.addImports("javax.annotation.PostConstruct", + "javax.annotation.PreDestroy", "groovy.util.logging.Log", "org.springframework.stereotype.Controller", "org.springframework.stereotype.Service", "org.springframework.stereotype.Component", diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java index 256f407041b..c7452d23b02 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java @@ -28,7 +28,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Dave Syer * @author Artem Bilan */ -public class SpringIntegrationCompilerAutoConfiguration extends CompilerAutoConfiguration { +public class SpringIntegrationCompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -38,9 +39,10 @@ public class SpringIntegrationCompilerAutoConfiguration extends CompilerAutoConf @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses( - "org.springframework.integration.config.EnableIntegration").add( - "spring-boot-starter-integration"); + dependencies + .ifAnyMissingClasses( + "org.springframework.integration.config.EnableIntegration") + .add("spring-boot-starter-integration"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java index 2aeb42cb347..a564067b3b4 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java @@ -33,17 +33,16 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio @Override public boolean matches(ClassNode classNode) { - return AstUtils.hasAtLeastOneAnnotation(classNode, "Controller", - "RestController", "EnableWebMvc"); + return AstUtils.hasAtLeastOneAnnotation(classNode, "Controller", "RestController", + "EnableWebMvc"); } @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies - .ifAnyMissingClasses("org.springframework.web.servlet.mvc.Controller") + dependencies.ifAnyMissingClasses("org.springframework.web.servlet.mvc.Controller") .add("spring-boot-starter-web"); - dependencies.ifAnyMissingClasses("groovy.text.TemplateEngine").add( - "groovy-templates"); + dependencies.ifAnyMissingClasses("groovy.text.TemplateEngine") + .add("groovy-templates"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialFacebookCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialFacebookCompilerAutoConfiguration.java index 37fe98393c6..74e5599eea6 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialFacebookCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialFacebookCompilerAutoConfiguration.java @@ -29,8 +29,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Craig Walls * @since 1.1.0 */ -public class SpringSocialFacebookCompilerAutoConfiguration extends - CompilerAutoConfiguration { +public class SpringSocialFacebookCompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -40,9 +40,9 @@ public class SpringSocialFacebookCompilerAutoConfiguration extends @Override public void applyDependencies(DependencyCustomizer dependencies) throws CompilationFailedException { - dependencies.ifAnyMissingClasses( - "org.springframework.social.facebook.api.Facebook").add( - "spring-boot-starter-social-facebook"); + dependencies + .ifAnyMissingClasses("org.springframework.social.facebook.api.Facebook") + .add("spring-boot-starter-social-facebook"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialLinkedInCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialLinkedInCompilerAutoConfiguration.java index 1f2763bd6b6..48b816858b5 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialLinkedInCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialLinkedInCompilerAutoConfiguration.java @@ -29,8 +29,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Craig Walls * @since 1.1.0 */ -public class SpringSocialLinkedInCompilerAutoConfiguration extends - CompilerAutoConfiguration { +public class SpringSocialLinkedInCompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -40,9 +40,9 @@ public class SpringSocialLinkedInCompilerAutoConfiguration extends @Override public void applyDependencies(DependencyCustomizer dependencies) throws CompilationFailedException { - dependencies.ifAnyMissingClasses( - "org.springframework.social.linkedin.api.LinkedIn").add( - "spring-boot-starter-social-linkedin"); + dependencies + .ifAnyMissingClasses("org.springframework.social.linkedin.api.LinkedIn") + .add("spring-boot-starter-social-linkedin"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialTwitterCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialTwitterCompilerAutoConfiguration.java index c107f52841e..1249fea364f 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialTwitterCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialTwitterCompilerAutoConfiguration.java @@ -29,8 +29,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Craig Walls * @since 1.1.0 */ -public class SpringSocialTwitterCompilerAutoConfiguration extends - CompilerAutoConfiguration { +public class SpringSocialTwitterCompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -40,8 +40,7 @@ public class SpringSocialTwitterCompilerAutoConfiguration extends @Override public void applyDependencies(DependencyCustomizer dependencies) throws CompilationFailedException { - dependencies - .ifAnyMissingClasses("org.springframework.social.twitter.api.Twitter") + dependencies.ifAnyMissingClasses("org.springframework.social.twitter.api.Twitter") .add("spring-boot-starter-social-twitter"); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java index 623bf8a4cbb..ebd287fded6 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java @@ -47,14 +47,14 @@ public class SpringTestCompilerAutoConfiguration extends CompilerAutoConfigurati @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses("org.springframework.http.HttpHeaders").add( - "spring-boot-starter-web"); + dependencies.ifAnyMissingClasses("org.springframework.http.HttpHeaders") + .add("spring-boot-starter-web"); } @Override - public void apply(GroovyClassLoader loader, - GroovyCompilerConfiguration configuration, GeneratorContext generatorContext, - SourceUnit source, ClassNode classNode) throws CompilationFailedException { + public void apply(GroovyClassLoader loader, GroovyCompilerConfiguration configuration, + GeneratorContext generatorContext, SourceUnit source, ClassNode classNode) + throws CompilationFailedException { if (!AstUtils.hasAtLeastOneAnnotation(classNode, "RunWith")) { AnnotationNode runwith = new AnnotationNode(ClassHelper.make("RunWith")); runwith.addMember("value", @@ -67,7 +67,7 @@ public class SpringTestCompilerAutoConfiguration extends CompilerAutoConfigurati public void applyImports(ImportCustomizer imports) throws CompilationFailedException { imports.addStarImports("org.junit.runner", "org.springframework.boot.test", "org.springframework.http", "org.springframework.test.context.junit4", - "org.springframework.test.annotation").addImports( - "org.springframework.test.context.web.WebAppConfiguration"); + "org.springframework.test.annotation") + .addImports("org.springframework.test.context.web.WebAppConfiguration"); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringWebsocketCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringWebsocketCompilerAutoConfiguration.java index 8cce4f8a4e3..020ee812aee 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringWebsocketCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringWebsocketCompilerAutoConfiguration.java @@ -49,8 +49,8 @@ public class SpringWebsocketCompilerAutoConfiguration extends CompilerAutoConfig "org.springframework.messaging.simp.config", "org.springframework.web.socket.handler", "org.springframework.web.socket.sockjs.transport.handler", - "org.springframework.web.socket.config.annotation").addImports( - "org.springframework.web.socket.WebSocketHandler"); + "org.springframework.web.socket.config.annotation") + .addImports("org.springframework.web.socket.WebSocketHandler"); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/TransactionManagementCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/TransactionManagementCompilerAutoConfiguration.java index 018a04e1dc6..9eb2815d385 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/TransactionManagementCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/TransactionManagementCompilerAutoConfiguration.java @@ -28,8 +28,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Dave Syer * @author Phillip Webb */ -public class TransactionManagementCompilerAutoConfiguration extends - CompilerAutoConfiguration { +public class TransactionManagementCompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -38,9 +38,10 @@ public class TransactionManagementCompilerAutoConfiguration extends @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses( - "org.springframework.transaction.annotation.Transactional").add( - "spring-tx", "spring-boot-starter-aop"); + dependencies + .ifAnyMissingClasses( + "org.springframework.transaction.annotation.Transactional") + .add("spring-tx", "spring-boot-starter-aop"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java index ffc0aec76cf..7048a711168 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java @@ -44,9 +44,9 @@ import groovy.grape.GrapeEngine; import groovy.lang.GroovyClassLoader; /** - * A {@link GrapeEngine} implementation that uses Aether, the dependency resolution system used by - * Maven. + * A {@link GrapeEngine} implementation that uses + * Aether, the dependency resolution system used + * by Maven. * * @author Andy Wilkinson * @author Phillip Webb @@ -55,6 +55,7 @@ import groovy.lang.GroovyClassLoader; public class AetherGrapeEngine implements GrapeEngine { private static final Collection WILDCARD_EXCLUSION; + static { List exclusions = new ArrayList(); exclusions.add(new Exclusion("*", "*", "*", "*")); @@ -199,8 +200,8 @@ public class AetherGrapeEngine implements GrapeEngine { private List getDependencies(DependencyResult dependencyResult) { List dependencies = new ArrayList(); for (ArtifactResult artifactResult : dependencyResult.getArtifactResults()) { - dependencies.add(new Dependency(artifactResult.getArtifact(), - JavaScopes.COMPILE)); + dependencies.add( + new Dependency(artifactResult.getArtifact(), JavaScopes.COMPILE)); } return dependencies; } @@ -239,8 +240,8 @@ public class AetherGrapeEngine implements GrapeEngine { } private RemoteRepository getPossibleMirror(RemoteRepository remoteRepository) { - RemoteRepository mirror = this.session.getMirrorSelector().getMirror( - remoteRepository); + RemoteRepository mirror = this.session.getMirrorSelector() + .getMirror(remoteRepository); if (mirror != null) { return mirror; } @@ -298,8 +299,8 @@ public class AetherGrapeEngine implements GrapeEngine { try { CollectRequest collectRequest = getCollectRequest(dependencies); DependencyRequest dependencyRequest = getDependencyRequest(collectRequest); - DependencyResult result = this.repositorySystem.resolveDependencies( - this.session, dependencyRequest); + DependencyResult result = this.repositorySystem + .resolveDependencies(this.session, dependencyRequest); addManagedDependencies(result); return getFiles(result); } @@ -314,8 +315,8 @@ public class AetherGrapeEngine implements GrapeEngine { private CollectRequest getCollectRequest(List dependencies) { CollectRequest collectRequest = new CollectRequest((Dependency) null, dependencies, new ArrayList(this.repositories)); - collectRequest.setManagedDependencies(this.resolutionContext - .getManagedDependencies()); + collectRequest + .setManagedDependencies(this.resolutionContext.getManagedDependencies()); return collectRequest; } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java index b9a4130ddef..d99847e1410 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java @@ -47,8 +47,8 @@ public abstract class AetherGrapeEngineFactory { List repositoryConfigurations, DependencyResolutionContext dependencyResolutionContext) { - RepositorySystem repositorySystem = createServiceLocator().getService( - RepositorySystem.class); + RepositorySystem repositorySystem = createServiceLocator() + .getService(RepositorySystem.class); DefaultRepositorySystemSession repositorySystemSession = MavenRepositorySystemUtils .newSession(); @@ -60,8 +60,8 @@ public abstract class AetherGrapeEngineFactory { autoConfiguration.apply(repositorySystemSession, repositorySystem); } - new DefaultRepositorySystemSessionAutoConfiguration().apply( - repositorySystemSession, repositorySystem); + new DefaultRepositorySystemSessionAutoConfiguration() + .apply(repositorySystemSession, repositorySystem); return new AetherGrapeEngine(classLoader, repositorySystem, repositorySystemSession, createRepositories(repositoryConfigurations), @@ -84,13 +84,13 @@ public abstract class AetherGrapeEngineFactory { repositoryConfigurations.size()); for (RepositoryConfiguration repositoryConfiguration : repositoryConfigurations) { RemoteRepository.Builder builder = new RemoteRepository.Builder( - repositoryConfiguration.getName(), "default", repositoryConfiguration - .getUri().toASCIIString()); + repositoryConfiguration.getName(), "default", + repositoryConfiguration.getUri().toASCIIString()); if (!repositoryConfiguration.getSnapshotsEnabled()) { - builder.setSnapshotPolicy(new RepositoryPolicy(false, - RepositoryPolicy.UPDATE_POLICY_NEVER, - RepositoryPolicy.CHECKSUM_POLICY_IGNORE)); + builder.setSnapshotPolicy( + new RepositoryPolicy(false, RepositoryPolicy.UPDATE_POLICY_NEVER, + RepositoryPolicy.CHECKSUM_POLICY_IGNORE)); } repositories.add(builder.build()); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java index 3393b92a73b..1cb55d640e3 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java @@ -33,8 +33,8 @@ import org.springframework.util.StringUtils; * * @author Andy Wilkinson */ -public class DefaultRepositorySystemSessionAutoConfiguration implements - RepositorySystemSessionAutoConfiguration { +public class DefaultRepositorySystemSessionAutoConfiguration + implements RepositorySystemSessionAutoConfiguration { @Override public void apply(DefaultRepositorySystemSession session, diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DetailedProgressReporter.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DetailedProgressReporter.java index ffa70a3aa7a..1d6426bfc76 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DetailedProgressReporter.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DetailedProgressReporter.java @@ -31,7 +31,8 @@ import org.eclipse.aether.transfer.TransferResource; */ final class DetailedProgressReporter implements ProgressReporter { - DetailedProgressReporter(DefaultRepositorySystemSession session, final PrintStream out) { + DetailedProgressReporter(DefaultRepositorySystemSession session, + final PrintStream out) { session.setTransferListener(new AbstractTransferListener() { @@ -56,8 +57,8 @@ final class DetailedProgressReporter implements ProgressReporter { private String getTransferSpeed(TransferEvent event) { long kb = event.getTransferredBytes() / 1024; - float seconds = (System.currentTimeMillis() - event.getResource() - .getTransferStartTime()) / 1000.0f; + float seconds = (System.currentTimeMillis() + - event.getResource().getTransferStartTime()) / 1000.0f; return String.format("%dKB at %.1fKB/sec", kb, (kb / seconds)); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfiguration.java index 0fbb818b76d..dbbdc5220d4 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfiguration.java @@ -31,8 +31,8 @@ import org.springframework.util.StringUtils; * @author Andy Wilkinson * @since 1.2.5 */ -public class GrapeRootRepositorySystemSessionAutoConfiguration implements - RepositorySystemSessionAutoConfiguration { +public class GrapeRootRepositorySystemSessionAutoConfiguration + implements RepositorySystemSessionAutoConfiguration { @Override public void apply(DefaultRepositorySystemSession session, diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/jar/PackagedSpringApplicationLauncher.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/jar/PackagedSpringApplicationLauncher.java index d913a9ce9a9..36dce8e53ec 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/jar/PackagedSpringApplicationLauncher.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/jar/PackagedSpringApplicationLauncher.java @@ -61,8 +61,8 @@ public final class PackagedSpringApplicationLauncher { return loadClasses(classLoader, sources.split(",")); } } - throw new IllegalStateException("Cannot locate " + SOURCE_ENTRY - + " in MANIFEST.MF"); + throw new IllegalStateException( + "Cannot locate " + SOURCE_ENTRY + " in MANIFEST.MF"); } private boolean isCliPackaged(Manifest manifest) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java index 2114bd0432d..4ee2bca21e3 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java @@ -77,8 +77,8 @@ public abstract class ResourceUtils { return getUrlsFromWildcardPath(path, classLoader); } catch (Exception ex) { - throw new IllegalArgumentException("Cannot create URL from path [" + path - + "]", ex); + throw new IllegalArgumentException( + "Cannot create URL from path [" + path + "]", ex); } } @@ -160,8 +160,9 @@ public abstract class ResourceUtils { public Resource getResource(String location) { Assert.notNull(location, "Location must not be null"); if (location.startsWith(CLASSPATH_URL_PREFIX)) { - return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX - .length()), getClassLoader()); + return new ClassPathResource( + location.substring(CLASSPATH_URL_PREFIX.length()), + getClassLoader()); } else { if (location.startsWith(FILE_URL_PREFIX)) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java b/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java index ea2f99ee2c2..74a0d4c5881 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java @@ -37,18 +37,19 @@ import groovy.text.TemplateEngine; */ public abstract class GroovyTemplate { - public static String template(String name) throws IOException, - CompilationFailedException, ClassNotFoundException { + public static String template(String name) + throws IOException, CompilationFailedException, ClassNotFoundException { return template(name, Collections.emptyMap()); } - public static String template(String name, Map model) throws IOException, - CompilationFailedException, ClassNotFoundException { + public static String template(String name, Map model) + throws IOException, CompilationFailedException, ClassNotFoundException { return template(new GStringTemplateEngine(), name, model); } - public static String template(TemplateEngine engine, String name, Map model) - throws IOException, CompilationFailedException, ClassNotFoundException { + public static String template(TemplateEngine engine, String name, + Map model) throws IOException, CompilationFailedException, + ClassNotFoundException { Writable writable = getTemplate(engine, name).make(model); StringWriter result = new StringWriter(); writable.writeTo(result); 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 9dee88b0904..08bfc88527c 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 @@ -160,8 +160,8 @@ public class CliTester implements TestRule { @Override public Statement apply(final Statement base, final Description description) { - final Statement statement = CliTester.this.outputCapture.apply( - new RunLauncherStatement(base), description); + final Statement statement = CliTester.this.outputCapture + .apply(new RunLauncherStatement(base), description); return new Statement() { @Override @@ -181,8 +181,8 @@ public class CliTester implements TestRule { public String getHttpOutput(String uri) { try { - InputStream stream = URI.create("http://localhost:" + this.port + uri) - .toURL().openStream(); + InputStream stream = URI.create("http://localhost:" + this.port + uri).toURL() + .openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); String line; StringBuilder result = new StringBuilder(); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java index 4c1fcc61a33..9edc3e9bd00 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java @@ -155,8 +155,8 @@ public class CommandRunnerTests { willThrow(new NullPointerException()).given(this.regularCommand).run(); int status = this.commandRunner.runAndHandleErrors("command"); assertThat(status, equalTo(1)); - assertThat(this.calls, equalTo((Set) EnumSet.of(Call.ERROR_MESSAGE, - Call.PRINT_STACK_TRACE))); + assertThat(this.calls, equalTo( + (Set) EnumSet.of(Call.ERROR_MESSAGE, Call.PRINT_STACK_TRACE))); } @Test @@ -165,8 +165,8 @@ public class CommandRunnerTests { int status = this.commandRunner.runAndHandleErrors("command", "-d"); assertEquals("true", System.getProperty("debug")); assertThat(status, equalTo(1)); - assertThat(this.calls, equalTo((Set) EnumSet.of(Call.ERROR_MESSAGE, - Call.PRINT_STACK_TRACE))); + assertThat(this.calls, equalTo( + (Set) EnumSet.of(Call.ERROR_MESSAGE, Call.PRINT_STACK_TRACE))); } @Test @@ -175,8 +175,8 @@ public class CommandRunnerTests { int status = this.commandRunner.runAndHandleErrors("command", "--debug"); assertEquals("true", System.getProperty("debug")); assertThat(status, equalTo(1)); - assertThat(this.calls, equalTo((Set) EnumSet.of(Call.ERROR_MESSAGE, - Call.PRINT_STACK_TRACE))); + assertThat(this.calls, equalTo( + (Set) EnumSet.of(Call.ERROR_MESSAGE, Call.PRINT_STACK_TRACE))); } @Test diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java index e4c0111a454..14f55cc7d50 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java @@ -87,8 +87,8 @@ public abstract class AbstractHttpClientMockTests { CloseableHttpResponse response = mock(CloseableHttpResponse.class); mockHttpEntity(response, request.content, request.contentType); mockStatus(response, 200); - String header = (request.fileName != null ? contentDispositionValue(request.fileName) - : null); + String header = (request.fileName != null + ? contentDispositionValue(request.fileName) : null); mockHttpHeader(response, "Content-Disposition", header); given(this.http.execute(argThat(getForNonMetadata()))).willReturn(response); } @@ -117,8 +117,8 @@ public abstract class AbstractHttpClientMockTests { try { HttpEntity entity = mock(HttpEntity.class); given(entity.getContent()).willReturn(new ByteArrayInputStream(content)); - Header contentTypeHeader = contentType != null ? new BasicHeader( - "Content-Type", contentType) : null; + Header contentTypeHeader = contentType != null + ? new BasicHeader("Content-Type", contentType) : null; given(entity.getContentType()).willReturn(contentTypeHeader); given(response.getEntity()).willReturn(entity); return entity; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java index d8e074c010b..290c9a32409 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java @@ -242,7 +242,8 @@ public class InitCommandTests extends AbstractHttpClientMockTests { MockHttpProjectGenerationRequest request = new MockHttpProjectGenerationRequest( "application/zip", file.getAbsolutePath()); mockSuccessfulProjectGeneration(request); - assertEquals("Should not have failed", ExitStatus.OK, this.command.run("--force")); + assertEquals("Should not have failed", ExitStatus.OK, + this.command.run("--force")); assertTrue("File should have changed", fileLength != file.length()); } @@ -379,8 +380,8 @@ public class InitCommandTests extends AbstractHttpClientMockTests { return bos.toByteArray(); } - private static class TestableInitCommandOptionHandler extends - InitCommand.InitOptionHandler { + private static class TestableInitCommandOptionHandler + extends InitCommand.InitOptionHandler { private boolean disableProjectGeneration; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java index 2ca4ac3215d..2bd2da41ef6 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java @@ -62,8 +62,8 @@ public class InitializrServiceMetadataTests { // Security description assertEquals("AOP", metadata.getDependency("aop").getName()); assertEquals("Security", metadata.getDependency("security").getName()); - assertEquals("Security description", metadata.getDependency("security") - .getDescription()); + assertEquals("Security description", + metadata.getDependency("security").getDescription()); assertEquals("JDBC", metadata.getDependency("jdbc").getName()); assertEquals("JPA", metadata.getDependency("data-jpa").getName()); assertEquals("MongoDB", metadata.getDependency("data-mongodb").getName()); @@ -88,12 +88,12 @@ public class InitializrServiceMetadataTests { } private static JSONObject readJson(String version) throws IOException { - Resource resource = new ClassPathResource("metadata/service-metadata-" + version - + ".json"); + Resource resource = new ClassPathResource( + "metadata/service-metadata-" + version + ".json"); InputStream stream = resource.getInputStream(); try { - return new JSONObject(StreamUtils.copyToString(stream, - Charset.forName("UTF-8"))); + return new JSONObject( + StreamUtils.copyToString(stream, Charset.forName("UTF-8"))); } finally { stream.close(); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceTests.java index 7acf8ddf966..b239f24b5d4 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceTests.java @@ -57,7 +57,8 @@ public class InitializrServiceTests extends AbstractHttpClientMockTests { MockHttpProjectGenerationRequest mockHttpRequest = new MockHttpProjectGenerationRequest( "application/xml", "foo.zip"); ProjectGenerationResponse entity = generateProject(request, mockHttpRequest); - assertProjectEntity(entity, mockHttpRequest.contentType, mockHttpRequest.fileName); + assertProjectEntity(entity, mockHttpRequest.contentType, + mockHttpRequest.fileName); } @Test @@ -158,8 +159,8 @@ public class InitializrServiceTests extends AbstractHttpClientMockTests { assertNull("No content type expected", entity.getContentType()); } else { - assertEquals("wrong mime type", mimeType, entity.getContentType() - .getMimeType()); + assertEquals("wrong mime type", mimeType, + entity.getContentType().getMimeType()); } assertEquals("wrong filename", fileName, entity.getFileName()); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java index d90a03ab094..ff06115d301 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java @@ -60,8 +60,9 @@ public class ProjectGenerationRequestTests { String customServerUrl = "http://foo:8080/initializr"; this.request.setServiceUrl(customServerUrl); this.request.getDependencies().add("security"); - assertEquals(new URI(customServerUrl - + "/starter.zip?dependencies=security&type=test-type"), + assertEquals( + new URI(customServerUrl + + "/starter.zip?dependencies=security&type=test-type"), this.request.generateUrl(createDefaultMetadata())); } @@ -108,8 +109,9 @@ public class ProjectGenerationRequestTests { InitializrServiceMetadata metadata = new InitializrServiceMetadata(projectType); this.request.setType("custom"); this.request.getDependencies().add("data-rest"); - assertEquals(new URI(ProjectGenerationRequest.DEFAULT_SERVICE_URL - + "/foo?dependencies=data-rest&type=custom"), + assertEquals( + new URI(ProjectGenerationRequest.DEFAULT_SERVICE_URL + + "/foo?dependencies=data-rest&type=custom"), this.request.generateUrl(metadata)); } @@ -249,8 +251,8 @@ public class ProjectGenerationRequestTests { private static InitializrServiceMetadata readMetadata(String version) { try { - Resource resource = new ClassPathResource("metadata/service-metadata-" - + version + ".json"); + Resource resource = new ClassPathResource( + "metadata/service-metadata-" + version + ".json"); String content = StreamUtils.copyToString(resource.getInputStream(), Charset.forName("UTF-8")); JSONObject json = new JSONObject(content); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java index 7c746390cde..f716944bf50 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java @@ -85,16 +85,16 @@ public class GroovyGrabDependencyResolverTests { @Test public void resolveArtifactWithNoDependencies() throws Exception { - List resolved = this.resolver.resolve(Arrays - .asList("commons-logging:commons-logging:1.1.3")); + List resolved = this.resolver + .resolve(Arrays.asList("commons-logging:commons-logging:1.1.3")); assertThat(resolved, hasSize(1)); assertThat(getNames(resolved), hasItems("commons-logging-1.1.3.jar")); } @Test public void resolveArtifactWithDependencies() throws Exception { - List resolved = this.resolver.resolve(Arrays - .asList("org.springframework:spring-core:4.1.1.RELEASE")); + List resolved = this.resolver + .resolve(Arrays.asList("org.springframework:spring-core:4.1.1.RELEASE")); assertThat(resolved, hasSize(2)); assertThat(getNames(resolved), hasItems("commons-logging-1.1.3.jar", "spring-core-4.1.1.RELEASE.jar")); @@ -114,10 +114,8 @@ public class GroovyGrabDependencyResolverTests { List resolved = this.resolver.resolve(Arrays.asList("junit:junit:4.11", "commons-logging:commons-logging:1.1.3")); assertThat(resolved, hasSize(3)); - assertThat( - getNames(resolved), - hasItems("junit-4.11.jar", "commons-logging-1.1.3.jar", - "hamcrest-core-1.3.jar")); + assertThat(getNames(resolved), hasItems("junit-4.11.jar", + "commons-logging-1.1.3.jar", "hamcrest-core-1.3.jar")); } public Set getNames(Collection files) { diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java index e667d7f9628..1cd786686b4 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java @@ -84,18 +84,18 @@ public class InstallerTests { File alpha = createTemporaryFile("alpha.jar"); File bravo = createTemporaryFile("bravo.jar"); File charlie = createTemporaryFile("charlie.jar"); - given(this.resolver.resolve(Arrays.asList("bravo"))).willReturn( - Arrays.asList(bravo, alpha)); - given(this.resolver.resolve(Arrays.asList("charlie"))).willReturn( - Arrays.asList(charlie, alpha)); + given(this.resolver.resolve(Arrays.asList("bravo"))) + .willReturn(Arrays.asList(bravo, alpha)); + given(this.resolver.resolve(Arrays.asList("charlie"))) + .willReturn(Arrays.asList(charlie, alpha)); this.installer.install(Arrays.asList("bravo")); assertThat(getNamesOfFilesInLib(), containsInAnyOrder("alpha.jar", "bravo.jar", ".installed")); this.installer.install(Arrays.asList("charlie")); - assertThat(getNamesOfFilesInLib(), - containsInAnyOrder("alpha.jar", "bravo.jar", "charlie.jar", ".installed")); + assertThat(getNamesOfFilesInLib(), containsInAnyOrder("alpha.jar", "bravo.jar", + "charlie.jar", ".installed")); this.installer.uninstall(Arrays.asList("bravo")); assertThat(getNamesOfFilesInLib(), @@ -111,15 +111,15 @@ public class InstallerTests { File bravo = createTemporaryFile("bravo.jar"); File charlie = createTemporaryFile("charlie.jar"); - given(this.resolver.resolve(Arrays.asList("bravo"))).willReturn( - Arrays.asList(bravo, alpha)); - given(this.resolver.resolve(Arrays.asList("charlie"))).willReturn( - Arrays.asList(charlie, alpha)); + given(this.resolver.resolve(Arrays.asList("bravo"))) + .willReturn(Arrays.asList(bravo, alpha)); + given(this.resolver.resolve(Arrays.asList("charlie"))) + .willReturn(Arrays.asList(charlie, alpha)); this.installer.install(Arrays.asList("bravo")); this.installer.install(Arrays.asList("charlie")); - assertThat(getNamesOfFilesInLib(), - containsInAnyOrder("alpha.jar", "bravo.jar", "charlie.jar", ".installed")); + assertThat(getNamesOfFilesInLib(), containsInAnyOrder("alpha.jar", "bravo.jar", + "charlie.jar", ".installed")); this.installer.uninstallAll(); assertThat(getNamesOfFilesInLib(), containsInAnyOrder(".installed")); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/jar/ResourceMatcherTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/jar/ResourceMatcherTests.java index 66d87cced5a..dad9c8f66ee 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/jar/ResourceMatcherTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/jar/ResourceMatcherTests.java @@ -45,10 +45,11 @@ public class ResourceMatcherTests { @Test public void nonExistentRoot() throws IOException { - ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("alpha/**", - "bravo/*", "*"), Arrays.asList(".*", "alpha/**/excluded")); - List matchedResources = resourceMatcher.find(Arrays - .asList(new File("does-not-exist"))); + ResourceMatcher resourceMatcher = new ResourceMatcher( + Arrays.asList("alpha/**", "bravo/*", "*"), + Arrays.asList(".*", "alpha/**/excluded")); + List matchedResources = resourceMatcher + .find(Arrays.asList(new File("does-not-exist"))); assertEquals(0, matchedResources.size()); } @@ -67,18 +68,18 @@ public class ResourceMatcherTests { public void excludedWins() throws Exception { ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("*"), Arrays.asList("**/*.jar")); - List found = resourceMatcher.find(Arrays.asList(new File( - "src/test/resources"))); + List found = resourceMatcher + .find(Arrays.asList(new File("src/test/resources"))); assertThat(found, not(hasItem(new FooJarMatcher(MatchedResource.class)))); } @SuppressWarnings("unchecked") @Test public void includedDeltas() throws Exception { - ResourceMatcher resourceMatcher = new ResourceMatcher( - Arrays.asList("-static/**"), Arrays.asList("")); - Collection includes = (Collection) ReflectionTestUtils.getField( - resourceMatcher, "includes"); + ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("-static/**"), + Arrays.asList("")); + Collection includes = (Collection) ReflectionTestUtils + .getField(resourceMatcher, "includes"); assertTrue(includes.contains("templates/**")); assertFalse(includes.contains("static/**")); } @@ -86,10 +87,10 @@ public class ResourceMatcherTests { @SuppressWarnings("unchecked") @Test public void includedDeltasAndNewEntries() throws Exception { - ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("-static/**", - "foo.jar"), Arrays.asList("-**/*.jar")); - Collection includes = (Collection) ReflectionTestUtils.getField( - resourceMatcher, "includes"); + ResourceMatcher resourceMatcher = new ResourceMatcher( + Arrays.asList("-static/**", "foo.jar"), Arrays.asList("-**/*.jar")); + Collection includes = (Collection) ReflectionTestUtils + .getField(resourceMatcher, "includes"); assertTrue(includes.contains("foo.jar")); assertTrue(includes.contains("templates/**")); assertFalse(includes.contains("static/**")); @@ -110,8 +111,9 @@ public class ResourceMatcherTests { public void jarFileAlwaysMatches() throws Exception { ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("*"), Arrays.asList("**/*.jar")); - List found = resourceMatcher.find(Arrays.asList(new File( - "src/test/resources/templates"), new File("src/test/resources/foo.jar"))); + List found = resourceMatcher + .find(Arrays.asList(new File("src/test/resources/templates"), + new File("src/test/resources/foo.jar"))); FooJarMatcher matcher = new FooJarMatcher(MatchedResource.class); assertThat(found, hasItem(matcher)); // A jar file is always treated as a dependency (stick it in /lib) @@ -120,12 +122,13 @@ public class ResourceMatcherTests { @Test public void resourceMatching() throws IOException { - ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("alpha/**", - "bravo/*", "*"), Arrays.asList(".*", "alpha/**/excluded")); - List matchedResources = resourceMatcher.find(Arrays.asList( - new File("src/test/resources/resource-matcher/one"), new File( - "src/test/resources/resource-matcher/two"), new File( - "src/test/resources/resource-matcher/three"))); + ResourceMatcher resourceMatcher = new ResourceMatcher( + Arrays.asList("alpha/**", "bravo/*", "*"), + Arrays.asList(".*", "alpha/**/excluded")); + List matchedResources = resourceMatcher + .find(Arrays.asList(new File("src/test/resources/resource-matcher/one"), + new File("src/test/resources/resource-matcher/two"), + new File("src/test/resources/resource-matcher/three"))); System.out.println(matchedResources); List paths = new ArrayList(); for (MatchedResource resource : matchedResources) { 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 d1aa0438c20..152b1c60fe0 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 @@ -35,8 +35,8 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { @Test public void simple() throws Exception { String s = "one two"; - assertThat(this.delimiter.delimit(s, 0).getArguments(), equalTo(new String[] { - "one", "two" })); + assertThat(this.delimiter.delimit(s, 0).getArguments(), + equalTo(new String[] { "one", "two" })); assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { "one", "two" })); assertThat(this.delimiter.isDelimiter(s, 2), equalTo(false)); @@ -47,8 +47,8 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { @Test public void escaped() throws Exception { String s = "o\\ ne two"; - assertThat(this.delimiter.delimit(s, 0).getArguments(), equalTo(new String[] { - "o\\ ne", "two" })); + assertThat(this.delimiter.delimit(s, 0).getArguments(), + equalTo(new String[] { "o\\ ne", "two" })); assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { "o ne", "two" })); assertThat(this.delimiter.isDelimiter(s, 2), equalTo(false)); @@ -60,28 +60,28 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { @Test public void quoted() throws Exception { String s = "'o ne' 't w o'"; - assertThat(this.delimiter.delimit(s, 0).getArguments(), equalTo(new String[] { - "'o ne'", "'t w o'" })); - assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { "o ne", - "t w o" })); + assertThat(this.delimiter.delimit(s, 0).getArguments(), + equalTo(new String[] { "'o ne'", "'t w o'" })); + assertThat(this.delimiter.parseArguments(s), + equalTo(new String[] { "o ne", "t w o" })); } @Test public void doubleQuoted() throws Exception { String s = "\"o ne\" \"t w o\""; - assertThat(this.delimiter.delimit(s, 0).getArguments(), equalTo(new String[] { - "\"o ne\"", "\"t w o\"" })); - assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { "o ne", - "t w o" })); + assertThat(this.delimiter.delimit(s, 0).getArguments(), + equalTo(new String[] { "\"o ne\"", "\"t w o\"" })); + assertThat(this.delimiter.parseArguments(s), + equalTo(new String[] { "o ne", "t w o" })); } @Test public void nestedQuotes() throws Exception { String s = "\"o 'n''e\" 't \"w o'"; - assertThat(this.delimiter.delimit(s, 0).getArguments(), equalTo(new String[] { - "\"o 'n''e\"", "'t \"w o'" })); - assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { "o 'n''e", - "t \"w o" })); + assertThat(this.delimiter.delimit(s, 0).getArguments(), + equalTo(new String[] { "\"o 'n''e\"", "'t \"w o'" })); + assertThat(this.delimiter.parseArguments(s), + equalTo(new String[] { "o 'n''e", "t \"w o" })); } @Test @@ -95,7 +95,8 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { @Test public void escapes() throws Exception { String s = "\\ \\\\.\\\\\\t"; - assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { " \\.\\\t" })); + assertThat(this.delimiter.parseArguments(s), + equalTo(new String[] { " \\.\\\t" })); } } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfigurationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfigurationTests.java index 87dededf9ad..d551265f6ef 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfigurationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfigurationTests.java @@ -58,38 +58,36 @@ public class GrapeRootRepositorySystemSessionAutoConfigurationTests { @Test public void noLocalRepositoryWhenNoGrapeRoot() { - given( - this.repositorySystem.newLocalRepositoryManager(eq(this.session), - any(LocalRepository.class))).willAnswer( - new Answer() { + given(this.repositorySystem.newLocalRepositoryManager(eq(this.session), + any(LocalRepository.class))) + .willAnswer(new Answer() { - @Override - public LocalRepositoryManager answer(InvocationOnMock invocation) - throws Throwable { - LocalRepository localRepository = invocation.getArgumentAt(1, - LocalRepository.class); - return new SimpleLocalRepositoryManagerFactory() - .newInstance( - GrapeRootRepositorySystemSessionAutoConfigurationTests.this.session, - localRepository); - } - }); + @Override + public LocalRepositoryManager answer( + InvocationOnMock invocation) throws Throwable { + LocalRepository localRepository = invocation + .getArgumentAt(1, LocalRepository.class); + return new SimpleLocalRepositoryManagerFactory() + .newInstance( + GrapeRootRepositorySystemSessionAutoConfigurationTests.this.session, + localRepository); + } + }); new GrapeRootRepositorySystemSessionAutoConfiguration().apply(this.session, this.repositorySystem); - verify(this.repositorySystem, times(0)).newLocalRepositoryManager( - eq(this.session), any(LocalRepository.class)); + verify(this.repositorySystem, times(0)) + .newLocalRepositoryManager(eq(this.session), any(LocalRepository.class)); assertThat(this.session.getLocalRepository(), is(nullValue())); } @Test public void grapeRootConfiguresLocalRepositoryLocation() { - given( - this.repositorySystem.newLocalRepositoryManager(eq(this.session), - any(LocalRepository.class))).willAnswer( - new LocalRepositoryManagerAnswer()); + given(this.repositorySystem.newLocalRepositoryManager(eq(this.session), + any(LocalRepository.class))) + .willAnswer(new LocalRepositoryManagerAnswer()); System.setProperty("grape.root", "foo"); try { @@ -100,8 +98,8 @@ public class GrapeRootRepositorySystemSessionAutoConfigurationTests { System.clearProperty("grape.root"); } - verify(this.repositorySystem, times(1)).newLocalRepositoryManager( - eq(this.session), any(LocalRepository.class)); + verify(this.repositorySystem, times(1)) + .newLocalRepositoryManager(eq(this.session), any(LocalRepository.class)); assertThat(this.session.getLocalRepository(), is(notNullValue())); assertThat(this.session.getLocalRepository().getBasedir().getAbsolutePath(), diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java index 281deaa654d..fa5eeec84e8 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java @@ -50,8 +50,8 @@ public class FlatdirTests { if (!this.libs.exists()) { this.libs.mkdirs(); } - FileCopyUtils.copy(new File("src/test/resources/foo.jar"), new File(this.libs, - "foo-1.0.0.jar")); + FileCopyUtils.copy(new File("src/test/resources/foo.jar"), + new File(this.libs, "foo-1.0.0.jar")); this.project.newBuild().forTasks("build") .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); } diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java index 2f060b41bbd..6d211a790a9 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java @@ -56,8 +56,8 @@ public class MultiProjectRepackagingTests { .withArguments("-PbootVersion=" + BOOT_VERSION).run(); File buildLibs = new File( "target/multi-project-common-file-dependency/build/libs"); - JarFile jarFile = new JarFile(new File(buildLibs, - "multi-project-common-file-dependency.jar")); + JarFile jarFile = new JarFile( + new File(buildLibs, "multi-project-common-file-dependency.jar")); assertThat(jarFile.getEntry("lib/foo.jar"), notNullValue()); jarFile.close(); } diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java index c0f830e4615..fc902e14c24 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java @@ -121,8 +121,8 @@ public class RepackagingTests { @Test public void repackageWithFileDependency() throws Exception { - FileCopyUtils.copy(new File("src/test/resources/foo.jar"), new File( - "target/repackage/foo.jar")); + FileCopyUtils.copy(new File("src/test/resources/foo.jar"), + new File("target/repackage/foo.jar")); project.newBuild().forTasks("clean", "build") .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run(); File buildLibs = new File("target/repackage/build/libs"); diff --git a/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorApplicationTests.java index 5b09fe9a16c..33ec5bdfcb7 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorApplicationTests.java @@ -50,8 +50,8 @@ public class SampleActuatorApplicationTests { @Test public void testHome() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity entity = new TestRestTemplate().getForEntity( - "http://localhost:" + port, Map.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity("http://localhost:" + port, Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map body = entity.getBody(); diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java index b9167fdd493..79bf41f402a 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java @@ -52,8 +52,8 @@ public class SampleActuatorUiApplicationPortTests { @Test public void testHome() throws Exception { - ResponseEntity entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); } diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java index 3b68092c0de..ef09de94a6a 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java @@ -58,11 +58,11 @@ public class SampleActuatorUiApplicationTests { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity entity = new TestRestTemplate().exchange( - "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity( - headers), String.class); + "http://localhost:" + this.port, HttpMethod.GET, + new HttpEntity(headers), String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity - .getBody().contains("Hello")); + assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), + entity.getBody().contains("<title>Hello")); } @Test @@ -76,8 +76,8 @@ public class SampleActuatorUiApplicationTests { @Test public void testMetrics() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/metrics", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/metrics", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } @@ -89,14 +89,12 @@ public class SampleActuatorUiApplicationTests { "http://localhost:" + this.port + "/error", HttpMethod.GET, new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); + assertTrue("Wrong body:\n" + entity.getBody(), + entity.getBody().contains("<html>")); + assertTrue("Wrong body:\n" + entity.getBody(), + entity.getBody().contains("<body>")); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody() - .contains("<html>")); - assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody() - .contains("<body>")); - assertTrue( - "Wrong body:\n" + entity.getBody(), - entity.getBody().contains( - "Please contact the operator with the above information")); + .contains("Please contact the operator with the above information")); } } diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java index 885239c67ee..2b4f1fa2e18 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java @@ -60,17 +60,16 @@ public class ManagementAddressActuatorApplicationTests { @Test public void testHome() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } @Test public void testHealth() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate() - .getForEntity( - "http://localhost:" + this.managementPort + "/admin/health", - String.class); + ResponseEntity<String> entity = new TestRestTemplate().getForEntity( + "http://localhost:" + this.managementPort + "/admin/health", + String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body: " + entity.getBody(), entity.getBody().contains("\"status\":\"UP\"")); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java index e4323e7580b..16dca6e6e75 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java @@ -61,14 +61,14 @@ public class ManagementPathSampleActuatorApplicationTests { @Test public void testHomeIsSecure() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Wrong body: " + body, "Unauthorized", body.get("error")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } } diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java index 8dc03f268eb..e549154a2d6 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java @@ -48,8 +48,8 @@ public class NonSensitiveHealthTests { @Test public void testSecureHealth() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/health", String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/health", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertFalse("Wrong body: " + entity.getBody(), entity.getBody().contains("\"hello\":1")); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java index 65a49859866..b56c0cb205f 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java @@ -64,30 +64,30 @@ public class SampleActuatorApplicationTests { @Test public void testHomeIsSecure() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Wrong body: " + body, "Unauthorized", body.get("error")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } @Test public void testMetricsIsSecure() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/metrics", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/metrics", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); - entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port - + "/metrics/", Map.class); + entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/metrics/", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); - entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port - + "/metrics/foo", Map.class); + entity = new TestRestTemplate().getForEntity( + "http://localhost:" + this.port + "/metrics/foo", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); - entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port - + "/metrics.json", Map.class); + entity = new TestRestTemplate().getForEntity( + "http://localhost:" + this.port + "/metrics.json", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } @@ -127,8 +127,8 @@ public class SampleActuatorApplicationTests { @Test public void testHealth() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/health", String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/health", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body: " + entity.getBody(), entity.getBody().contains("\"status\":\"UP\"")); @@ -147,11 +147,11 @@ public class SampleActuatorApplicationTests { @Test public void testInfo() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/info", String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/info", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body: " + entity.getBody(), - entity.getBody().contains("\"artifact\":\"spring-boot-sample-actuator\"")); + assertTrue("Wrong body: " + entity.getBody(), entity.getBody() + .contains("\"artifact\":\"spring-boot-sample-actuator\"")); } @Test @@ -199,8 +199,8 @@ public class SampleActuatorApplicationTests { @Test public void testErrorPageDirectAccess() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/error", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/error", Map.class); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); @@ -225,7 +225,8 @@ public class SampleActuatorApplicationTests { public void testConfigProps() throws Exception { @SuppressWarnings("rawtypes") ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword()) - .getForEntity("http://localhost:" + this.port + "/configprops", Map.class); + .getForEntity("http://localhost:" + this.port + "/configprops", + Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java index 8585f2091b8..ad92f576500 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java @@ -74,14 +74,14 @@ public class ServletPathSampleActuatorApplicationTests { @Test public void testHomeIsSecure() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/spring/", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/spring/", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Wrong body: " + body, "Unauthorized", body.get("error")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } } diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathUnsecureSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathUnsecureSampleActuatorApplicationTests.java index 1eeb229a18b..cc5ec509caf 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathUnsecureSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathUnsecureSampleActuatorApplicationTests.java @@ -53,14 +53,14 @@ public class ServletPathUnsecureSampleActuatorApplicationTests { @Test public void testHome() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/spring/", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/spring/", Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Hello Phil", body.get("message")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } @Test diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureManagementSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureManagementSampleActuatorApplicationTests.java index ed557204d77..19d774295bd 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureManagementSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureManagementSampleActuatorApplicationTests.java @@ -55,14 +55,14 @@ public class UnsecureManagementSampleActuatorApplicationTests { @Test public void testHomeIsSecure() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Wrong body: " + body, "Unauthorized", body.get("error")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } @Test @@ -74,12 +74,13 @@ public class UnsecureManagementSampleActuatorApplicationTests { // ignore; } @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/metrics", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/metrics", Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); - assertTrue("Wrong body: " + body, body.containsKey("counter.status.401.unmapped")); + assertTrue("Wrong body: " + body, + body.containsKey("counter.status.401.unmapped")); } } diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureSampleActuatorApplicationTests.java index b034ad7a380..742af3d0987 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureSampleActuatorApplicationTests.java @@ -52,14 +52,14 @@ public class UnsecureSampleActuatorApplicationTests { @Test public void testHome() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Hello Phil", body.get("message")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } } diff --git a/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/ChatService.java b/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/ChatService.java index cccf7b774e8..f92a5aa25f7 100644 --- a/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/ChatService.java +++ b/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/ChatService.java @@ -53,8 +53,8 @@ public class ChatService { return message; } - public static class JacksonEncoderDecoder implements Encoder<Message, String>, - Decoder<String, Message> { + public static class JacksonEncoderDecoder + implements Encoder<Message, String>, Decoder<String, Message> { private final ObjectMapper mapper = new ObjectMapper(); diff --git a/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java b/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java index efe9c724751..3b32ca24eed 100644 --- a/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java @@ -60,9 +60,9 @@ public class SampleAtmosphereApplicationTests { public void chatEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties( - "websocket.uri:ws://localhost:" + this.port + "/chat/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + this.port + + "/chat/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-batch/src/main/java/sample/batch/SampleBatchApplication.java b/spring-boot-samples/spring-boot-sample-batch/src/main/java/sample/batch/SampleBatchApplication.java index cc2e62754f7..fbf9c26cc59 100644 --- a/spring-boot-samples/spring-boot-sample-batch/src/main/java/sample/batch/SampleBatchApplication.java +++ b/spring-boot-samples/spring-boot-sample-batch/src/main/java/sample/batch/SampleBatchApplication.java @@ -64,8 +64,8 @@ public class SampleBatchApplication { public static void main(String[] args) throws Exception { // System.exit is common for Batch applications since the exit code can be used to // drive a workflow - System.exit(SpringApplication.exit(SpringApplication.run( - SampleBatchApplication.class, args))); + System.exit(SpringApplication + .exit(SpringApplication.run(SampleBatchApplication.class, args))); } } diff --git a/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java b/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java index 6b469edd872..8c92a38bebc 100644 --- a/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java @@ -31,8 +31,8 @@ public class SampleBatchApplicationTests { @Test public void testDefaultSettings() throws Exception { - assertEquals(0, SpringApplication.exit(SpringApplication - .run(SampleBatchApplication.class))); + assertEquals(0, SpringApplication + .exit(SpringApplication.run(SampleBatchApplication.class))); String output = this.outputCapture.toString(); assertTrue("Wrong output: " + output, output.contains("completed with the following parameters")); diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java index dfe7f277ee3..2303ac01109 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java @@ -88,8 +88,8 @@ public class Gemstone implements Serializable { @Override public String toString() { - return String.format("{ @type = %1$s, id = %2$d, name = %3$s }", getClass() - .getName(), getId(), getName()); + return String.format("{ @type = %1$s, id = %2$d, name = %3$s }", + getClass().getName(), getId(), getName()); } } diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java index d995958b4d1..fd9268612f9 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java @@ -40,8 +40,8 @@ import sample.data.gemfire.domain.Gemstone; public class GemstoneServiceImpl implements GemstoneService { protected static final List<String> APPROVED_GEMS = new ArrayList<String>( - Arrays.asList("ALEXANDRITE", "AQUAMARINE", "DIAMOND", "OPAL", "PEARL", - "RUBY", "SAPPHIRE", "SPINEL", "TOPAZ")); + Arrays.asList("ALEXANDRITE", "AQUAMARINE", "DIAMOND", "OPAL", "PEARL", "RUBY", + "SAPPHIRE", "SPINEL", "TOPAZ")); @Autowired private GemstoneRepository gemstoneRepo; @@ -127,9 +127,10 @@ public class GemstoneServiceImpl implements GemstoneService { // to demonstrate transactions in GemFire. Gemstone savedGemstone = validate(this.gemstoneRepo.save(gemstone)); - Assert.state(savedGemstone.equals(get(gemstone.getId())), String.format( - "Failed to find Gemstone (%1$s) in GemFire's Cache Region 'Gemstones'!", - gemstone)); + Assert.state(savedGemstone.equals(get(gemstone.getId())), + String.format( + "Failed to find Gemstone (%1$s) in GemFire's Cache Region 'Gemstones'!", + gemstone)); System.out.printf("Saved Gemstone (%1$s)%n", savedGemstone.getName()); @@ -141,8 +142,8 @@ public class GemstoneServiceImpl implements GemstoneService { // NOTE if the Gemstone is not valid, blow chunks (should cause transaction to // rollback in GemFire)! System.err.printf("Illegal Gemstone (%1$s)!%n", gemstone.getName()); - throw new IllegalGemstoneException(String.format( - "'%1$s' is not a valid Gemstone!", gemstone.getName())); + throw new IllegalGemstoneException( + String.format("'%1$s' is not a valid Gemstone!", gemstone.getName())); } return gemstone; diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java index ea79f0ab1c4..68473c9abec 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java @@ -95,8 +95,8 @@ public class SampleDataGemFireApplicationTests { this.gemstoneService.save(createGemstone("Ruby")); assertEquals(2, this.gemstoneService.count()); - assertTrue(asList(this.gemstoneService.list()).containsAll( - getGemstones("Diamond", "Ruby"))); + assertTrue(asList(this.gemstoneService.list()) + .containsAll(getGemstones("Diamond", "Ruby"))); try { this.gemstoneService.save(createGemstone("Coal")); @@ -105,15 +105,15 @@ public class SampleDataGemFireApplicationTests { } assertEquals(2, this.gemstoneService.count()); - assertTrue(asList(this.gemstoneService.list()).containsAll( - getGemstones("Diamond", "Ruby"))); + assertTrue(asList(this.gemstoneService.list()) + .containsAll(getGemstones("Diamond", "Ruby"))); this.gemstoneService.save(createGemstone("Pearl")); this.gemstoneService.save(createGemstone("Sapphire")); assertEquals(4, this.gemstoneService.count()); - assertTrue(asList(this.gemstoneService.list()).containsAll( - getGemstones("Diamond", "Ruby", "Pearl", "Sapphire"))); + assertTrue(asList(this.gemstoneService.list()) + .containsAll(getGemstones("Diamond", "Ruby", "Pearl", "Sapphire"))); try { this.gemstoneService.save(createGemstone("Quartz")); @@ -122,8 +122,8 @@ public class SampleDataGemFireApplicationTests { } assertEquals(4, this.gemstoneService.count()); - assertTrue(asList(this.gemstoneService.list()).containsAll( - getGemstones("Diamond", "Ruby", "Pearl", "Sapphire"))); + assertTrue(asList(this.gemstoneService.list()) + .containsAll(getGemstones("Diamond", "Ruby", "Pearl", "Sapphire"))); assertEquals(createGemstone("Diamond"), this.gemstoneService.get("Diamond")); assertEquals(createGemstone("Pearl"), this.gemstoneService.get("Pearl")); } 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 fabe2daeb60..bf03d13efc9 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 @@ -39,10 +39,10 @@ public class HotelSummary implements Serializable { public HotelSummary(City city, String name, Double averageRating) { this.city = city; this.name = name; - this.averageRating = averageRating == null ? null : new BigDecimal(averageRating, - MATH_CONTEXT).doubleValue(); - this.averageRatingRounded = averageRating == null ? null : (int) Math - .round(averageRating); + this.averageRating = averageRating == null ? null + : new BigDecimal(averageRating, MATH_CONTEXT).doubleValue(); + this.averageRatingRounded = averageRating == null ? null + : (int) Math.round(averageRating); } public City getCity() { diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java index d5fd6dfa68b..c733b3adfbf 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java @@ -36,7 +36,8 @@ class CityServiceImpl implements CityService { private final HotelRepository hotelRepository; @Autowired - public CityServiceImpl(CityRepository cityRepository, HotelRepository hotelRepository) { + public CityServiceImpl(CityRepository cityRepository, + HotelRepository hotelRepository) { this.cityRepository = cityRepository; this.hotelRepository = hotelRepository; } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java index 00c66d017b4..f416b25da09 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java @@ -73,12 +73,9 @@ public class SampleDataJpaApplicationTests { @Test public void testJmx() throws Exception { - assertEquals( - 1, - ManagementFactory - .getPlatformMBeanServer() - .queryMBeans(new ObjectName("jpa.sample:type=ConnectionPool,*"), - null).size()); + assertEquals(1, ManagementFactory.getPlatformMBeanServer() + .queryMBeans(new ObjectName("jpa.sample:type=ConnectionPool,*"), null) + .size()); } } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java index d17fa537367..933bfa05257 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java @@ -59,10 +59,10 @@ public class HotelRepositoryIntegrationTests { .get(0); assertThat(city.getName(), is("Atlanta")); - Page<HotelSummary> hotels = this.repository.findByCity(city, new PageRequest(0, - 10, Direction.ASC, "name")); - Hotel hotel = this.repository.findByCityAndName(city, hotels.getContent().get(0) - .getName()); + Page<HotelSummary> hotels = this.repository.findByCity(city, + new PageRequest(0, 10, Direction.ASC, "name")); + Hotel hotel = this.repository.findByCityAndName(city, + hotels.getContent().get(0).getName()); assertThat(hotel.getName(), is("Doubletree")); List<RatingCount> counts = this.repository.findRatingCounts(hotel); diff --git a/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java b/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java index f782b4dda37..2b0d5d8d8ee 100644 --- a/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java @@ -34,8 +34,8 @@ public class SampleFlywayApplicationTests { @Test public void testDefaultSettings() throws Exception { - assertEquals(new Integer(1), this.template.queryForObject( - "SELECT COUNT(*) from PERSON", Integer.class)); + assertEquals(new Integer(1), this.template + .queryForObject("SELECT COUNT(*) from PERSON", Integer.class)); } } diff --git a/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/web/CustomerController.java b/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/web/CustomerController.java index bbb524ec3b9..1ccbbe79871 100644 --- a/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/web/CustomerController.java +++ b/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/web/CustomerController.java @@ -49,7 +49,8 @@ public class CustomerController { @RequestMapping(method = RequestMethod.GET) HttpEntity<Resources<Customer>> showCustomers() { - Resources<Customer> resources = new Resources<Customer>(this.repository.findAll()); + Resources<Customer> resources = new Resources<Customer>( + this.repository.findAll()); resources.add(this.entityLinks.linkToCollectionResource(Customer.class)); return new ResponseEntity<Resources<Customer>>(resources, HttpStatus.OK); } diff --git a/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java b/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java index 19fc99de816..531a810ed45 100644 --- a/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java @@ -48,8 +48,8 @@ public class SampleHateoasApplicationTests { ResponseEntity<String> entity = new TestRestTemplate().getForEntity( "http://localhost:" + this.port + "/customers/1", String.class); assertThat(entity.getStatusCode(), equalTo(HttpStatus.OK)); - assertThat(entity.getBody(), startsWith("{\"id\":1,\"firstName\":\"Oliver\"" - + ",\"lastName\":\"Gierke\"")); + assertThat(entity.getBody(), startsWith( + "{\"id\":1,\"firstName\":\"Oliver\"" + ",\"lastName\":\"Gierke\"")); assertThat(entity.getBody(), containsString("_links\":{\"self\":{\"href\"")); } diff --git a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java index 28e60d07852..5447b72504e 100644 --- a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java @@ -75,8 +75,8 @@ public class SampleIntegrationApplicationTests { } private String getOutput() throws Exception { - Future<String> future = Executors.newSingleThreadExecutor().submit( - new Callable<String>() { + Future<String> future = Executors.newSingleThreadExecutor() + .submit(new Callable<String>() { @Override public String call() throws Exception { Resource[] resources = getResourcesWithContent(); @@ -96,8 +96,9 @@ public class SampleIntegrationApplicationTests { } private Resource[] getResourcesWithContent() throws IOException { - Resource[] candidates = ResourcePatternUtils.getResourcePatternResolver( - new DefaultResourceLoader()).getResources("file:target/output/**"); + Resource[] candidates = ResourcePatternUtils + .getResourcePatternResolver(new DefaultResourceLoader()) + .getResources("file:target/output/**"); for (Resource candidate : candidates) { if (candidate.contentLength() == 0) { return new Resource[0]; diff --git a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/producer/ProducerApplication.java b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/producer/ProducerApplication.java index 2907b73acff..f703e4686da 100644 --- a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/producer/ProducerApplication.java +++ b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/producer/ProducerApplication.java @@ -30,8 +30,8 @@ public class ProducerApplication implements CommandLineRunner { public void run(String... args) throws Exception { new File("target/input").mkdirs(); if (args.length > 0) { - FileOutputStream stream = new FileOutputStream("target/input/data" - + System.currentTimeMillis() + ".txt"); + FileOutputStream stream = new FileOutputStream( + "target/input/data" + System.currentTimeMillis() + ".txt"); for (String arg : args) { stream.write(arg.getBytes()); } diff --git a/spring-boot-samples/spring-boot-sample-jersey/src/main/java/sample/jersey/SampleJerseyApplication.java b/spring-boot-samples/spring-boot-sample-jersey/src/main/java/sample/jersey/SampleJerseyApplication.java index ee8213c9e98..7bd15a9915a 100644 --- a/spring-boot-samples/spring-boot-sample-jersey/src/main/java/sample/jersey/SampleJerseyApplication.java +++ b/spring-boot-samples/spring-boot-sample-jersey/src/main/java/sample/jersey/SampleJerseyApplication.java @@ -29,8 +29,9 @@ public class SampleJerseyApplication extends SpringBootServletInitializer { } public static void main(String[] args) { - new SampleJerseyApplication().configure( - new SpringApplicationBuilder(SampleJerseyApplication.class)).run(args); + new SampleJerseyApplication() + .configure(new SpringApplicationBuilder(SampleJerseyApplication.class)) + .run(args); } } diff --git a/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java b/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java index 9dbcc718f1c..5d47bb031f5 100644 --- a/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java @@ -43,8 +43,8 @@ public class SampleJerseyApplicationTests { @Test public void contextLoads() { - ResponseEntity<String> entity = this.restTemplate.getForEntity( - "http://localhost:" + this.port + "/hello", String.class); + ResponseEntity<String> entity = this.restTemplate + .getForEntity("http://localhost:" + this.port + "/hello", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); } @@ -58,8 +58,8 @@ public class SampleJerseyApplicationTests { @Test public void validation() { - ResponseEntity<String> entity = this.restTemplate.getForEntity( - "http://localhost:" + this.port + "/reverse", String.class); + ResponseEntity<String> entity = this.restTemplate + .getForEntity("http://localhost:" + this.port + "/reverse", String.class); assertEquals(HttpStatus.BAD_REQUEST, entity.getStatusCode()); } diff --git a/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java b/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java index 3bc8fa96c2e..d7f1dd76646 100644 --- a/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java @@ -38,8 +38,8 @@ public class SampleJersey1ApplicationTests { @Test public void contextLoads() { - assertEquals("Hello World", new TestRestTemplate().getForObject( - "http://localhost:" + this.port + "/", String.class)); + assertEquals("Hello World", new TestRestTemplate() + .getForObject("http://localhost:" + this.port + "/", String.class)); } } diff --git a/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java index a3a3e7db771..c5d75690fe3 100644 --- a/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java @@ -54,8 +54,8 @@ public class SampleJettySslApplicationTests { @Test public void testHome() throws Exception { SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( - new SSLContextBuilder().loadTrustMaterial(null, - new TrustSelfSignedStrategy()).build()); + new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build()); HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory) .build(); @@ -63,8 +63,8 @@ public class SampleJettySslApplicationTests { TestRestTemplate testRestTemplate = new TestRestTemplate(); ((HttpComponentsClientHttpRequestFactory) testRestTemplate.getRequestFactory()) .setHttpClient(httpClient); - ResponseEntity<String> entity = testRestTemplate.getForEntity( - "https://localhost:" + this.port, String.class); + ResponseEntity<String> entity = testRestTemplate + .getForEntity("https://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java index b164a05a470..e7191a5c2b7 100644 --- a/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java @@ -57,8 +57,8 @@ public class SampleJettyApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java index 696fb59af22..dbd262b4dac 100644 --- a/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java @@ -54,8 +54,8 @@ public class SampleJetty8SslApplicationTests { @Test public void testHome() throws Exception { SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( - new SSLContextBuilder().loadTrustMaterial(null, - new TrustSelfSignedStrategy()).build()); + new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build()); HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory) .build(); @@ -63,8 +63,8 @@ public class SampleJetty8SslApplicationTests { TestRestTemplate testRestTemplate = new TestRestTemplate(); ((HttpComponentsClientHttpRequestFactory) testRestTemplate.getRequestFactory()) .setHttpClient(httpClient); - ResponseEntity<String> entity = testRestTemplate.getForEntity( - "https://localhost:" + this.port, String.class); + ResponseEntity<String> entity = testRestTemplate + .getForEntity("https://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java index 621ffb9a83f..923cc518b40 100644 --- a/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java @@ -57,8 +57,8 @@ public class SampleJetty8ApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/SampleAtomikosApplication.java b/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/SampleAtomikosApplication.java index 801bc9ec36a..3fc7484bf65 100644 --- a/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/SampleAtomikosApplication.java +++ b/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/SampleAtomikosApplication.java @@ -26,8 +26,8 @@ import org.springframework.context.ApplicationContext; public class SampleAtomikosApplication { public static void main(String[] args) throws Exception { - ApplicationContext context = SpringApplication.run( - SampleAtomikosApplication.class, args); + ApplicationContext context = SpringApplication + .run(SampleAtomikosApplication.class, args); AccountService service = context.getBean(AccountService.class); AccountRepository repository = context.getBean(AccountRepository.class); service.createAccountAndNotify("josh"); diff --git a/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/java/sample/bitronix/SampleBitronixApplication.java b/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/java/sample/bitronix/SampleBitronixApplication.java index edfa4c8a094..830dae3e514 100644 --- a/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/java/sample/bitronix/SampleBitronixApplication.java +++ b/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/java/sample/bitronix/SampleBitronixApplication.java @@ -26,8 +26,8 @@ import org.springframework.context.ApplicationContext; public class SampleBitronixApplication { public static void main(String[] args) throws Exception { - ApplicationContext context = SpringApplication.run( - SampleBitronixApplication.class, args); + ApplicationContext context = SpringApplication + .run(SampleBitronixApplication.class, args); AccountService service = context.getBean(AccountService.class); AccountRepository repository = context.getBean(AccountRepository.class); service.createAccountAndNotify("josh"); diff --git a/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java b/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java index 390e7297807..9dc68d26c9b 100644 --- a/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java @@ -41,20 +41,19 @@ public class SampleLiquibaseApplicationTests { } } String output = this.outputCapture.toString(); - assertTrue( - "Wrong output: " + output, + assertTrue("Wrong output: " + output, output.contains("Successfully acquired change log lock") && output.contains("Creating database history " + "table with name: PUBLIC.DATABASECHANGELOG") - && output.contains("Table person created") - && output.contains("ChangeSet classpath:/db/" - + "changelog/db.changelog-master.yaml::1::" - + "marceloverdijk ran successfully") - && output.contains("New row inserted into person") - && output.contains("ChangeSet classpath:/db/changelog/" - + "db.changelog-master.yaml::2::" - + "marceloverdijk ran successfully") - && output.contains("Successfully released change log lock")); + && output.contains("Table person created") + && output.contains("ChangeSet classpath:/db/" + + "changelog/db.changelog-master.yaml::1::" + + "marceloverdijk ran successfully") + && output.contains("New row inserted into person") + && output.contains("ChangeSet classpath:/db/changelog/" + + "db.changelog-master.yaml::2::" + + "marceloverdijk ran successfully") + && output.contains("Successfully released change log lock")); } private boolean serverNotRunning(IllegalStateException ex) { diff --git a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java index 61a8a546e3c..4212d5df3f0 100644 --- a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java @@ -86,15 +86,16 @@ public class SampleIntegrationParentApplicationTests { } private Resource[] findResources() throws IOException { - return ResourcePatternUtils.getResourcePatternResolver( - new DefaultResourceLoader()).getResources("file:target/output/**/*.msg"); + return ResourcePatternUtils + .getResourcePatternResolver(new DefaultResourceLoader()) + .getResources("file:target/output/**/*.msg"); } private String readResources(Resource[] resources) throws IOException { StringBuilder builder = new StringBuilder(); for (Resource resource : resources) { - builder.append(new String(StreamUtils.copyToByteArray(resource - .getInputStream()))); + builder.append( + new String(StreamUtils.copyToByteArray(resource.getInputStream()))); } return builder.toString(); } diff --git a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/producer/ProducerApplication.java b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/producer/ProducerApplication.java index 4ae50ad3d64..fb14d4774f8 100644 --- a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/producer/ProducerApplication.java +++ b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/producer/ProducerApplication.java @@ -30,8 +30,8 @@ public class ProducerApplication implements CommandLineRunner { public void run(String... args) throws Exception { new File("target/input").mkdirs(); if (args.length > 0) { - FileOutputStream stream = new FileOutputStream("target/input/data" - + System.currentTimeMillis() + ".txt"); + FileOutputStream stream = new FileOutputStream( + "target/input/data" + System.currentTimeMillis() + ".txt"); for (String arg : args) { stream.write(arg.getBytes()); } diff --git a/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleSecureApplication.java b/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleSecureApplication.java index dbfeb69b2fc..7f2c3129ef9 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleSecureApplication.java +++ b/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleSecureApplication.java @@ -36,9 +36,9 @@ public class SampleSecureApplication implements CommandLineRunner { @Override public void run(String... args) throws Exception { - SecurityContextHolder.getContext().setAuthentication( - new UsernamePasswordAuthenticationToken("user", "N/A", AuthorityUtils - .commaSeparatedStringToAuthorityList("ROLE_USER"))); + SecurityContextHolder.getContext() + .setAuthentication(new UsernamePasswordAuthenticationToken("user", "N/A", + AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER"))); try { System.out.println(this.service.secure()); } diff --git a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java index e6dbb1f5b25..ae3930daec9 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java @@ -58,8 +58,8 @@ public class SampleSecureApplicationTests { public void init() { AuthenticationManager authenticationManager = this.context .getBean(AuthenticationManager.class); - this.authentication = authenticationManager - .authenticate(new UsernamePasswordAuthenticationToken("user", "password")); + this.authentication = authenticationManager.authenticate( + new UsernamePasswordAuthenticationToken("user", "password")); } @After diff --git a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java index f374e8c42ff..98ea2bd9108 100644 --- a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java @@ -52,8 +52,8 @@ public class SampleServletApplicationTests { @Test public void testHomeIsSecure() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } diff --git a/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java b/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java index ce180c67536..9bba94db8e6 100644 --- a/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java @@ -43,8 +43,8 @@ public class SampleTestNGApplicationTests extends AbstractTestNGSpringContextTes @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java index 6f43c4a02e2..09a069bcd0e 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java @@ -48,8 +48,8 @@ public class SampleWebJspApplicationTests { @Test public void testJspWithEl() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("/resources/text.txt")); diff --git a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java index f49f166fb87..fc010912020 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java @@ -71,15 +71,13 @@ public class SampleTomcatTwoConnectorsApplicationTests { X509TrustManager tm = new X509TrustManager() { @Override - public void checkClientTrusted( - java.security.cert.X509Certificate[] chain, String authType) - throws java.security.cert.CertificateException { + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, + String authType) throws java.security.cert.CertificateException { } @Override - public void checkServerTrusted( - java.security.cert.X509Certificate[] chain, String authType) - throws java.security.cert.CertificateException { + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, + String authType) throws java.security.cert.CertificateException { } @Override @@ -103,19 +101,21 @@ public class SampleTomcatTwoConnectorsApplicationTests { new HostnameVerifier() { @Override - public boolean verify(final String hostname, final SSLSession session) { + public boolean verify(final String hostname, + final SSLSession session) { return true; // these guys are alright by me... } }); template.setRequestFactory(factory); - ResponseEntity<String> entity = template.getForEntity("http://localhost:" - + this.port + "/hello", String.class); + ResponseEntity<String> entity = template + .getForEntity("http://localhost:" + this.port + "/hello", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("hello", entity.getBody()); - ResponseEntity<String> httpsEntity = template.getForEntity("https://localhost:" - + this.context.getBean("port") + "/hello", String.class); + ResponseEntity<String> httpsEntity = template.getForEntity( + "https://localhost:" + this.context.getBean("port") + "/hello", + String.class); assertEquals(HttpStatus.OK, httpsEntity.getStatusCode()); assertEquals("hello", httpsEntity.getBody()); diff --git a/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java index 713400ba3c3..2c342ac0e40 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java @@ -51,8 +51,8 @@ public class SampleTomcatSslApplicationTests { @Test public void testHome() throws Exception { SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( - new SSLContextBuilder().loadTrustMaterial(null, - new TrustSelfSignedStrategy()).build()); + new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build()); HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory) .build(); @@ -60,8 +60,8 @@ public class SampleTomcatSslApplicationTests { TestRestTemplate testRestTemplate = new TestRestTemplate(); ((HttpComponentsClientHttpRequestFactory) testRestTemplate.getRequestFactory()) .setHttpClient(httpClient); - ResponseEntity<String> entity = testRestTemplate.getForEntity( - "https://localhost:" + this.port, String.class); + ResponseEntity<String> entity = testRestTemplate + .getForEntity("https://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello, world", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java index 4473cf31c6a..e821d417c2e 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java @@ -65,7 +65,8 @@ public class NonAutoConfigurationSampleTomcatApplicationTests { ServerPropertiesAutoConfiguration.class, WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) - @ComponentScan(basePackageClasses = { SampleController.class, HelloWorldService.class }) + @ComponentScan(basePackageClasses = { SampleController.class, + HelloWorldService.class }) public static class NonAutoConfigurationSampleTomcatApplication { public static void main(String[] args) throws Exception { @@ -76,8 +77,8 @@ public class NonAutoConfigurationSampleTomcatApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java index 3e2a7dc712c..71577575cbd 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java @@ -55,8 +55,8 @@ public class SampleTomcatApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java index c9ac322330e..5c4ed07697d 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java @@ -48,8 +48,8 @@ public class SampleWebJspApplicationTests { @Test public void testJspWithEl() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("/resources/text.txt")); diff --git a/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java b/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java index f83b928da16..5f605eb76c7 100644 --- a/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java +++ b/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java @@ -51,7 +51,8 @@ public class WebConfig extends WebMvcConfigurerAdapter { } @Override - public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { + public void configureDefaultServletHandling( + DefaultServletHandlerConfigurer configurer) { configurer.enable(); } } diff --git a/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java b/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java index ddfb9b7adde..5cbf2cf3a68 100644 --- a/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java @@ -48,8 +48,8 @@ public class SampleTraditionalApplicationTests { @Test public void testHomeJsp() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); String body = entity.getBody(); assertTrue("Wrong body:\n" + body, body.contains("<html>")); diff --git a/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java b/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java index d20a95cb235..65025c35788 100644 --- a/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java @@ -54,8 +54,8 @@ public class SampleUndertowSslApplicationTests { @Test public void testHome() throws Exception { SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( - new SSLContextBuilder().loadTrustMaterial(null, - new TrustSelfSignedStrategy()).build()); + new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build()); HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory) .build(); @@ -63,8 +63,8 @@ public class SampleUndertowSslApplicationTests { TestRestTemplate testRestTemplate = new TestRestTemplate(); ((HttpComponentsClientHttpRequestFactory) testRestTemplate.getRequestFactory()) .setHttpClient(httpClient); - ResponseEntity<String> entity = testRestTemplate.getForEntity( - "https://localhost:" + this.port, String.class); + ResponseEntity<String> entity = testRestTemplate + .getForEntity("https://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java index d639e6d0ca3..82d8fb77af9 100644 --- a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java @@ -86,8 +86,8 @@ public class SampleUndertowApplicationTests { } private void assertOkResponse(String path, String body) { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + path, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + path, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals(body, entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java index 883bbe1340a..3f65e4dcee8 100644 --- a/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java @@ -55,8 +55,8 @@ public class SampleWebFreeMarkerApplicationTests { @Test public void testFreeMarkerTemplate() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("Hello, Andy")); @@ -73,8 +73,8 @@ public class SampleWebFreeMarkerApplicationTests { requestEntity, String.class); assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode()); - assertTrue("Wrong body:\n" + responseEntity.getBody(), responseEntity.getBody() - .contains("Something went wrong: 404 Not Found")); + assertTrue("Wrong body:\n" + responseEntity.getBody(), + responseEntity.getBody().contains("Something went wrong: 404 Not Found")); } } diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java index dd7b3b93191..daafe8e40ec 100644 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java @@ -53,13 +53,13 @@ public class SampleGroovyTemplateApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity - .getBody().contains("<title>Messages")); - assertFalse("Wrong body (found layout:fragment):\n" + entity.getBody(), entity - .getBody().contains("layout:fragment")); + assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), + entity.getBody().contains("<title>Messages")); + assertFalse("Wrong body (found layout:fragment):\n" + entity.getBody(), + entity.getBody().contains("layout:fragment")); } @Test @@ -67,8 +67,8 @@ public class SampleGroovyTemplateApplicationTests { MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>(); map.set("text", "FOO text"); map.set("summary", "FOO"); - URI location = new TestRestTemplate().postForLocation("http://localhost:" - + this.port, map); + URI location = new TestRestTemplate() + .postForLocation("http://localhost:" + this.port, map); assertTrue("Wrong location:\n" + location, location.toString().contains("localhost:" + this.port)); } diff --git a/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java index a48397e1eaf..91fad287368 100644 --- a/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java @@ -48,8 +48,8 @@ public class SampleWebJspApplicationTests { @Test public void testJspWithEl() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("/resources/text.txt")); diff --git a/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/security/method/SampleMethodSecurityApplication.java b/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/security/method/SampleMethodSecurityApplication.java index 3fd4eb0656e..228ec199921 100644 --- a/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/security/method/SampleMethodSecurityApplication.java +++ b/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/security/method/SampleMethodSecurityApplication.java @@ -75,8 +75,8 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter { @Order(Ordered.HIGHEST_PRECEDENCE) @Configuration - protected static class AuthenticationSecurity extends - GlobalAuthenticationConfigurerAdapter { + protected static class AuthenticationSecurity + extends GlobalAuthenticationConfigurerAdapter { @Override public void init(AuthenticationManagerBuilder auth) throws Exception { diff --git a/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java index eb007587b05..13efc4032df 100644 --- a/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java @@ -61,11 +61,11 @@ public class SampleMethodSecurityApplicationTests { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = new TestRestTemplate().exchange( - "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>( - headers), String.class); + "http://localhost:" + this.port, HttpMethod.GET, + new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity - .getBody().contains("<title>Login")); + assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), + entity.getBody().contains("<title>Login")); } @Test @@ -81,8 +81,8 @@ public class SampleMethodSecurityApplicationTests { new HttpEntity<MultiValueMap<String, String>>(form, headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertEquals("http://localhost:" + this.port + "/", entity.getHeaders() - .getLocation().toString()); + assertEquals("http://localhost:" + this.port + "/", + entity.getHeaders().getLocation().toString()); } @Test @@ -100,18 +100,18 @@ public class SampleMethodSecurityApplicationTests { assertEquals(HttpStatus.FOUND, entity.getStatusCode()); String cookie = entity.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); - ResponseEntity<String> page = new TestRestTemplate().exchange(entity.getHeaders() - .getLocation(), HttpMethod.GET, new HttpEntity<Void>(headers), - String.class); + ResponseEntity<String> page = new TestRestTemplate().exchange( + entity.getHeaders().getLocation(), HttpMethod.GET, + new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.FORBIDDEN, page.getStatusCode()); - assertTrue("Wrong body (message doesn't match):\n" + entity.getBody(), page - .getBody().contains("Access denied")); + assertTrue("Wrong body (message doesn't match):\n" + entity.getBody(), + page.getBody().contains("Access denied")); } @Test public void testManagementProtected() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/beans", String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/beans", String.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } @@ -130,8 +130,8 @@ public class SampleMethodSecurityApplicationTests { } private void getCsrf(MultiValueMap<String, String> form, HttpHeaders headers) { - ResponseEntity<String> page = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/login", String.class); + ResponseEntity<String> page = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/login", String.class); String cookie = page.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); String body = page.getBody(); diff --git a/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java index af1f364aef5..96a47aee178 100644 --- a/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java @@ -55,8 +55,8 @@ public class SampleWebMustacheApplicationTests { @Test public void testMustacheTemplate() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("Hello, Andy")); @@ -73,8 +73,8 @@ public class SampleWebMustacheApplicationTests { requestEntity, String.class); assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode()); - assertTrue("Wrong body:\n" + responseEntity.getBody(), responseEntity.getBody() - .contains("Something went wrong: 404 Not Found")); + assertTrue("Wrong body:\n" + responseEntity.getBody(), + responseEntity.getBody().contains("Something went wrong: 404 Not Found")); } } diff --git a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java index af6437293a0..db7de2cf026 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java @@ -64,11 +64,11 @@ public class SampleWebSecureCustomApplicationTests { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = new TestRestTemplate().exchange( - "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>( - headers), String.class); + "http://localhost:" + this.port, HttpMethod.GET, + new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/login")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/login")); } @Test @@ -96,16 +96,16 @@ public class SampleWebSecureCustomApplicationTests { new HttpEntity<MultiValueMap<String, String>>(form, headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/")); assertNotNull("Missing cookie:\n" + entity.getHeaders(), entity.getHeaders().get("Set-Cookie")); } private HttpHeaders getHeaders() { HttpHeaders headers = new HttpHeaders(); - ResponseEntity<String> page = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/login", String.class); + ResponseEntity<String> page = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/login", String.class); assertEquals(HttpStatus.OK, page.getStatusCode()); String cookie = page.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); diff --git a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java index e4c0b0b0673..bf0752e6e9f 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java @@ -62,11 +62,11 @@ public class SampleWebSecureCustomApplicationTests { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = new TestRestTemplate().exchange( - "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>( - headers), String.class); + "http://localhost:" + this.port, HttpMethod.GET, + new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/login")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/login")); } @Test @@ -94,16 +94,16 @@ public class SampleWebSecureCustomApplicationTests { new HttpEntity<MultiValueMap<String, String>>(form, headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/")); assertNotNull("Missing cookie:\n" + entity.getHeaders(), entity.getHeaders().get("Set-Cookie")); } private HttpHeaders getHeaders() { HttpHeaders headers = new HttpHeaders(); - ResponseEntity<String> page = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/login", String.class); + ResponseEntity<String> page = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/login", String.class); assertEquals(HttpStatus.OK, page.getStatusCode()); String cookie = page.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); diff --git a/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java index c07918b0644..559bb373f2b 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java @@ -62,11 +62,11 @@ public class SampleSecureApplicationTests { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = new TestRestTemplate().exchange( - "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>( - headers), String.class); + "http://localhost:" + this.port, HttpMethod.GET, + new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/login")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/login")); } @Test @@ -94,16 +94,16 @@ public class SampleSecureApplicationTests { new HttpEntity<MultiValueMap<String, String>>(form, headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/")); assertNotNull("Missing cookie:\n" + entity.getHeaders(), entity.getHeaders().get("Set-Cookie")); } private HttpHeaders getHeaders() { HttpHeaders headers = new HttpHeaders(); - ResponseEntity<String> page = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/login", String.class); + ResponseEntity<String> page = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/login", String.class); assertEquals(HttpStatus.OK, page.getStatusCode()); String cookie = page.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); diff --git a/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/webstatic/SampleWebStaticApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/webstatic/SampleWebStaticApplicationTests.java index f579ca8594d..e2c620ec4a9 100644 --- a/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/webstatic/SampleWebStaticApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/webstatic/SampleWebStaticApplicationTests.java @@ -51,23 +51,25 @@ public class SampleWebStaticApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity - .getBody().contains("<title>Static")); + assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), + entity.getBody().contains("<title>Static")); } @Test public void testCss() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port - + "/webjars/bootstrap/3.0.3/css/bootstrap.min.css", String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity( + "http://localhost:" + this.port + + "/webjars/bootstrap/3.0.3/css/bootstrap.min.css", + String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("body")); assertEquals("Wrong content type:\n" + entity.getHeaders().getContentType(), - MediaType.valueOf("text/css;charset=UTF-8"), entity.getHeaders() - .getContentType()); + MediaType.valueOf("text/css;charset=UTF-8"), + entity.getHeaders().getContentType()); } } diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/ui/SampleWebUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/ui/SampleWebUiApplicationTests.java index 6fcc5c311a2..c2f08befbfd 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/ui/SampleWebUiApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/ui/SampleWebUiApplicationTests.java @@ -55,13 +55,13 @@ public class SampleWebUiApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity - .getBody().contains("<title>Messages")); - assertFalse("Wrong body (found layout:fragment):\n" + entity.getBody(), entity - .getBody().contains("layout:fragment")); + assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), + entity.getBody().contains("<title>Messages")); + assertFalse("Wrong body (found layout:fragment):\n" + entity.getBody(), + entity.getBody().contains("layout:fragment")); } @Test @@ -69,8 +69,8 @@ public class SampleWebUiApplicationTests { MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>(); map.set("text", "FOO text"); map.set("summary", "FOO"); - URI location = new TestRestTemplate().postForLocation("http://localhost:" - + this.port, map); + URI location = new TestRestTemplate() + .postForLocation("http://localhost:" + this.port, map); assertTrue("Wrong location:\n" + location, location.toString().contains("localhost:" + this.port)); } diff --git a/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/web/velocity/SampleWebVelocityApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/web/velocity/SampleWebVelocityApplicationTests.java index b0773268737..b35a8d87702 100644 --- a/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/web/velocity/SampleWebVelocityApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/web/velocity/SampleWebVelocityApplicationTests.java @@ -55,8 +55,8 @@ public class SampleWebVelocityApplicationTests { @Test public void testVelocityTemplate() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("Hello, Andy")); @@ -73,8 +73,8 @@ public class SampleWebVelocityApplicationTests { requestEntity, String.class); assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode()); - assertTrue("Wrong body:\n" + responseEntity.getBody(), responseEntity.getBody() - .contains("Something went wrong: 404 Not Found")); + assertTrue("Wrong body:\n" + responseEntity.getBody(), + responseEntity.getBody().contains("Something went wrong: 404 Not Found")); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/reverse/ReverseWebSocketEndpoint.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/reverse/ReverseWebSocketEndpoint.java index 8a1e3871fe0..049835bd59a 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/reverse/ReverseWebSocketEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/reverse/ReverseWebSocketEndpoint.java @@ -27,7 +27,7 @@ public class ReverseWebSocketEndpoint { @OnMessage public void handleMessage(Session session, String message) throws IOException { - session.getBasicRemote().sendText( - "Reversed: " + new StringBuilder(message).reverse()); + session.getBasicRemote() + .sendText("Reversed: " + new StringBuilder(message).reverse()); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java index 0c7c01fc9e9..da2d1351820 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java @@ -106,7 +106,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { SnakeTimer.removeSnake(this.snake); - SnakeTimer.broadcast(String.format("{'type': 'leave', 'id': %d}", - Integer.valueOf(this.id))); + SnakeTimer.broadcast( + String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id))); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java index fe47e8cb59d..d430134645c 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java @@ -61,9 +61,9 @@ public class SampleWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties( - "websocket.uri:ws://localhost:" + this.port + "/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + this.port + + "/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -76,8 +76,9 @@ public class SampleWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + this.port + "/reverse") - .run("--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + this.port + "/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java index 892a9185959..14cf4e7d68b 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java @@ -67,8 +67,9 @@ public class CustomContainerWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + PORT + + "/ws/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -81,8 +82,9 @@ public class CustomContainerWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/reverse").run( - "--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + PORT + "/ws/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/reverse/ReverseWebSocketEndpoint.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/reverse/ReverseWebSocketEndpoint.java index 1e20d267ed0..f0fb893daee 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/reverse/ReverseWebSocketEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/reverse/ReverseWebSocketEndpoint.java @@ -27,7 +27,7 @@ public class ReverseWebSocketEndpoint { @OnMessage public void handleMessage(Session session, String message) throws IOException { - session.getBasicRemote().sendText( - "Reversed: " + new StringBuilder(message).reverse()); + session.getBasicRemote() + .sendText("Reversed: " + new StringBuilder(message).reverse()); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java index dfd4690c90d..8bdd45e3bc6 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java @@ -106,7 +106,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { SnakeTimer.removeSnake(this.snake); - SnakeTimer.broadcast(String.format("{'type': 'leave', 'id': %d}", - Integer.valueOf(this.id))); + SnakeTimer.broadcast( + String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id))); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java index 80022f60474..6a4ce242da8 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java @@ -61,9 +61,9 @@ public class SampleWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties( - "websocket.uri:ws://localhost:" + this.port + "/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + this.port + + "/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -76,8 +76,9 @@ public class SampleWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + this.port + "/reverse") - .run("--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + this.port + "/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java index f142de8066e..378563197a8 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java @@ -67,8 +67,9 @@ public class CustomContainerWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + PORT + + "/ws/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -81,8 +82,9 @@ public class CustomContainerWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/reverse").run( - "--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + PORT + "/ws/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/reverse/ReverseWebSocketEndpoint.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/reverse/ReverseWebSocketEndpoint.java index e5f205bf6fd..5b9421366a3 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/reverse/ReverseWebSocketEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/reverse/ReverseWebSocketEndpoint.java @@ -27,7 +27,7 @@ public class ReverseWebSocketEndpoint { @OnMessage public void handleMessage(Session session, String message) throws IOException { - session.getBasicRemote().sendText( - "Reversed: " + new StringBuilder(message).reverse()); + session.getBasicRemote() + .sendText("Reversed: " + new StringBuilder(message).reverse()); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java index 8f5affebb21..30557bdfb8f 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java @@ -106,7 +106,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { SnakeTimer.removeSnake(this.snake); - SnakeTimer.broadcast(String.format("{'type': 'leave', 'id': %d}", - Integer.valueOf(this.id))); + SnakeTimer.broadcast( + String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id))); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java index d767ecc6403..27abb2ca985 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java @@ -61,9 +61,9 @@ public class SampleWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties( - "websocket.uri:ws://localhost:" + this.port + "/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + this.port + + "/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -76,8 +76,9 @@ public class SampleWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + this.port + "/reverse") - .run("--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + this.port + "/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java index 8de6b546ab8..be7a53b2ad3 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java @@ -67,8 +67,9 @@ public class CustomContainerWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + PORT + + "/ws/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -81,8 +82,9 @@ public class CustomContainerWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/reverse").run( - "--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + PORT + "/ws/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java index c74c2e916d6..3850c6efd27 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java @@ -33,7 +33,8 @@ import org.springframework.xml.xsd.XsdSchema; public class WebServiceConfig extends WsConfigurerAdapter { @Bean - public ServletRegistrationBean dispatcherServlet(ApplicationContext applicationContext) { + public ServletRegistrationBean dispatcherServlet( + ApplicationContext applicationContext) { MessageDispatcherServlet servlet = new MessageDispatcherServlet(); servlet.setApplicationContext(applicationContext); return new ServletRegistrationBean(servlet, "/services/*"); diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java index a7b7634ff40..dfa079b0ac0 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java @@ -69,10 +69,10 @@ public class HolidayEndpoint { public void handleHolidayRequest(@RequestPayload Element holidayRequest) throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date startDate = dateFormat.parse(this.startDateExpression.evaluateFirst( - holidayRequest).getText()); - Date endDate = dateFormat.parse(this.endDateExpression.evaluateFirst( - holidayRequest).getText()); + Date startDate = dateFormat + .parse(this.startDateExpression.evaluateFirst(holidayRequest).getText()); + Date endDate = dateFormat + .parse(this.endDateExpression.evaluateFirst(holidayRequest).getText()); String name = this.nameExpression.evaluateFirst(holidayRequest); this.humanResourceService.bookHoliday(startDate, endDate, name); diff --git a/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java b/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java index 1aa23721f76..9effee2d5ae 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java @@ -51,22 +51,18 @@ public class SampleWsApplicationTests { @Before public void setUp() { - this.webServiceTemplate.setDefaultUri("http://localhost:" + this.serverPort - + "/services/"); + this.webServiceTemplate + .setDefaultUri("http://localhost:" + this.serverPort + "/services/"); } @Test public void testSendingHolidayRequest() { final String request = "<hr:HolidayRequest xmlns:hr=\"http://mycompany.com/hr/schemas\">" - + " <hr:Holiday>" - + " <hr:StartDate>2013-10-20</hr:StartDate>" - + " <hr:EndDate>2013-11-22</hr:EndDate>" - + " </hr:Holiday>" - + " <hr:Employee>" - + " <hr:Number>1</hr:Number>" + + " <hr:Holiday>" + " <hr:StartDate>2013-10-20</hr:StartDate>" + + " <hr:EndDate>2013-11-22</hr:EndDate>" + " </hr:Holiday>" + + " <hr:Employee>" + " <hr:Number>1</hr:Number>" + " <hr:FirstName>John</hr:FirstName>" - + " <hr:LastName>Doe</hr:LastName>" - + " </hr:Employee>" + + " <hr:LastName>Doe</hr:LastName>" + " </hr:Employee>" + "</hr:HolidayRequest>"; StreamSource source = new StreamSource(new StringReader(request)); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java index 6623e604059..7b7ff324573 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java @@ -95,11 +95,13 @@ public class MetadataCollector { private boolean shouldBeMerged(ItemMetadata itemMetadata) { String sourceType = itemMetadata.getSourceType(); - return (sourceType != null && !deletedInCurrentBuild(sourceType) && !processedInCurrentBuild(sourceType)); + return (sourceType != null && !deletedInCurrentBuild(sourceType) + && !processedInCurrentBuild(sourceType)); } private boolean deletedInCurrentBuild(String sourceType) { - return this.processingEnvironment.getElementUtils().getTypeElement(sourceType) == null; + return this.processingEnvironment.getElementUtils() + .getTypeElement(sourceType) == null; } private boolean processedInCurrentBuild(String sourceType) { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java index 8bfcca82414..58ae1cbe8f6 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java @@ -97,21 +97,21 @@ public class MetadataStore { } private FileObject getMetadataResource() throws IOException { - FileObject resource = this.environment.getFiler().getResource( - StandardLocation.CLASS_OUTPUT, "", METADATA_PATH); + FileObject resource = this.environment.getFiler() + .getResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH); return resource; } private FileObject createMetadataResource() throws IOException { - FileObject resource = this.environment.getFiler().createResource( - StandardLocation.CLASS_OUTPUT, "", METADATA_PATH); + FileObject resource = this.environment.getFiler() + .createResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH); return resource; } private InputStream getAdditionalMetadataStream() throws IOException { // Most build systems will have copied the file to the class output location - FileObject fileObject = this.environment.getFiler().getResource( - StandardLocation.CLASS_OUTPUT, "", ADDITIONAL_METADATA_PATH); + FileObject fileObject = this.environment.getFiler() + .getResource(StandardLocation.CLASS_OUTPUT, "", ADDITIONAL_METADATA_PATH); File file = new File(fileObject.toUri()); if (!file.exists()) { // Gradle keeps things separate @@ -123,8 +123,8 @@ public class MetadataStore { file = new File(path); } } - return (file.exists() ? new FileInputStream(file) : fileObject.toUri().toURL() - .openStream()); + return (file.exists() ? new FileInputStream(file) + : fileObject.toUri().toURL().openStream()); } } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java index 8754d4b75c7..1e19d2d84c8 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java @@ -54,8 +54,8 @@ class TypeElementMembers { } private void process(TypeElement element) { - for (ExecutableElement method : ElementFilter.methodsIn(element - .getEnclosedElements())) { + for (ExecutableElement method : ElementFilter + .methodsIn(element.getEnclosedElements())) { processMethod(method); } for (VariableElement field : ElementFilter @@ -95,14 +95,14 @@ class TypeElementMembers { } private boolean isSetterReturnType(ExecutableElement method) { - return (TypeKind.VOID == method.getReturnType().getKind() || this.env - .getTypeUtils().isSameType(method.getEnclosingElement().asType(), - method.getReturnType())); + return (TypeKind.VOID == method.getReturnType().getKind() + || this.env.getTypeUtils().isSameType( + method.getEnclosingElement().asType(), method.getReturnType())); } private String getAccessorName(String methodName) { - String name = methodName.startsWith("is") ? methodName.substring(2) : methodName - .substring(3); + String name = methodName.startsWith("is") ? methodName.substring(2) + : methodName.substring(3); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); return name; } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java index 5cb887e3360..b5a1e35852a 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java @@ -40,6 +40,7 @@ import javax.lang.model.util.Types; class TypeUtils { private static final Map<TypeKind, Class<?>> PRIMITIVE_WRAPPERS; + static { Map<TypeKind, Class<?>> wrappers = new HashMap<TypeKind, Class<?>>(); wrappers.put(TypeKind.BOOLEAN, Boolean.class); @@ -63,8 +64,9 @@ class TypeUtils { this.env = env; Types types = env.getTypeUtils(); WildcardType wc = types.getWildcardType(null, null); - this.collectionType = types.getDeclaredType(this.env.getElementUtils() - .getTypeElement(Collection.class.getName()), wc); + this.collectionType = types.getDeclaredType( + this.env.getElementUtils().getTypeElement(Collection.class.getName()), + wc); this.mapType = types.getDeclaredType( this.env.getElementUtils().getTypeElement(Map.class.getName()), wc, wc); } @@ -108,8 +110,8 @@ class TypeUtils { } public String getJavaDoc(Element element) { - String javadoc = (element == null ? null : this.env.getElementUtils() - .getDocComment(element)); + String javadoc = (element == null ? null + : this.env.getElementUtils().getDocComment(element)); if (javadoc != null) { javadoc = javadoc.trim(); } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java index 177b9cdb68a..6c9e80e293d 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java @@ -60,6 +60,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser { private static class FieldCollector implements TreeVisitor { private static final Map<String, Class<?>> WRAPPER_TYPES; + static { Map<String, Class<?>> types = new HashMap<String, Class<?>>(); types.put("boolean", Boolean.class); @@ -76,6 +77,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser { } private static final Map<Class<?>, Object> DEFAULT_TYPE_VALUES; + static { Map<Class<?>, Object> values = new HashMap<Class<?>, Object>(); values.put(Boolean.class, false); @@ -87,6 +89,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser { } private static final Map<String, Object> WELL_KNOWN_STATIC_FINALS; + static { Map<String, Object> values = new HashMap<String, Object>(); values.put("Boolean.TRUE", true); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java index 5a2606cc830..12672102b50 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java @@ -41,9 +41,11 @@ class Tree extends ReflectionWrapper { } public void accept(TreeVisitor visitor) throws Exception { - this.acceptMethod.invoke(getInstance(), Proxy.newProxyInstance(getInstance() - .getClass().getClassLoader(), new Class<?>[] { this.treeVisitorType }, - new TreeVisitorInvocationHandler(visitor)), 0); + this.acceptMethod.invoke(getInstance(), + Proxy.newProxyInstance(getInstance().getClass().getClassLoader(), + new Class<?>[] { this.treeVisitorType }, + new TreeVisitorInvocationHandler(visitor)), + 0); } /** @@ -59,7 +61,8 @@ class Tree extends ReflectionWrapper { @Override @SuppressWarnings("rawtypes") - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable { if (method.getName().equals("visitClass")) { if ((Integer) args[1] == 0) { Iterable members = (Iterable) Tree.this.GET_CLASS_TREE_MEMBERS diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestCompiler.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestCompiler.java index a66b7b71869..37143a6f453 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestCompiler.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestCompiler.java @@ -73,9 +73,10 @@ public class TestCompiler { return getTask(javaFileObjects); } - private TestCompilationTask getTask(Iterable<? extends JavaFileObject> javaFileObjects) { - return new TestCompilationTask(this.compiler.getTask(null, this.fileManager, - null, null, null, javaFileObjects)); + private TestCompilationTask getTask( + Iterable<? extends JavaFileObject> javaFileObjects) { + return new TestCompilationTask(this.compiler.getTask(null, this.fileManager, null, + null, null, javaFileObjects)); } public File getOutputLocation() { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestConfigurationMetadataAnnotationProcessor.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestConfigurationMetadataAnnotationProcessor.java index b50e78b04e7..698bf650186 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestConfigurationMetadataAnnotationProcessor.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestConfigurationMetadataAnnotationProcessor.java @@ -35,8 +35,8 @@ import org.springframework.boot.configurationprocessor.metadata.JsonMarshaller; */ @SupportedAnnotationTypes({ "*" }) @SupportedSourceVersion(SourceVersion.RELEASE_6) -public class TestConfigurationMetadataAnnotationProcessor extends - ConfigurationMetadataAnnotationProcessor { +public class TestConfigurationMetadataAnnotationProcessor + extends ConfigurationMetadataAnnotationProcessor { static final String CONFIGURATION_PROPERTIES_ANNOTATION = "org.springframework.boot.configurationsample.ConfigurationProperties"; @@ -74,8 +74,8 @@ public class TestConfigurationMetadataAnnotationProcessor extends File metadataFile = new File(this.outputLocation, "META-INF/spring-configuration-metadata.json"); if (metadataFile.isFile()) { - this.metadata = new JsonMarshaller().read(new FileInputStream( - metadataFile)); + this.metadata = new JsonMarshaller() + .read(new FileInputStream(metadataFile)); } else { this.metadata = new ConfigurationMetadata(); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java index 4176ee80247..778db5bf742 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java @@ -140,8 +140,8 @@ public class TestProject { File targetFile = getSourceFile(target); String contents = getContents(targetFile); int insertAt = contents.lastIndexOf('}'); - String additionalSource = FileCopyUtils.copyToString(new InputStreamReader( - snippetStream)); + String additionalSource = FileCopyUtils + .copyToString(new InputStreamReader(snippetStream)); contents = contents.substring(0, insertAt) + additionalSource + contents.substring(insertAt); putContents(targetFile, contents); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java index 8cb0487e3f9..7daa18f1885 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java @@ -86,8 +86,8 @@ public abstract class AbstractFieldValuesProcessorTests { equalToObject(new Object[] { "FOO", "BAR" })); assertThat(values.get("stringArrayNone"), nullValue()); assertThat(values.get("stringEmptyArray"), equalToObject(new Object[0])); - assertThat(values.get("stringArrayConst"), equalToObject(new Object[] { "OK", - "KO" })); + assertThat(values.get("stringArrayConst"), + equalToObject(new Object[] { "OK", "KO" })); assertThat(values.get("stringArrayConstElements"), equalToObject(new Object[] { "c" })); assertThat(values.get("integerArray"), equalToObject(new Object[] { 42, 24 })); @@ -98,7 +98,8 @@ public abstract class AbstractFieldValuesProcessorTests { return equalTo(object); } - @SupportedAnnotationTypes({ "org.springframework.boot.configurationsample.ConfigurationProperties" }) + @SupportedAnnotationTypes({ + "org.springframework.boot.configurationsample.ConfigurationProperties" }) @SupportedSourceVersion(SourceVersion.RELEASE_6) private class TestProcessor extends AbstractProcessor { @@ -118,8 +119,8 @@ public abstract class AbstractFieldValuesProcessorTests { for (Element element : roundEnv.getElementsAnnotatedWith(annotation)) { if (element instanceof TypeElement) { try { - this.values.putAll(this.processor - .getFieldValues((TypeElement) element)); + this.values.putAll( + this.processor.getFieldValues((TypeElement) element)); } catch (Exception ex) { throw new IllegalStateException(ex); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesProcessorTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesProcessorTests.java index bc1424ac742..ae22d1cd971 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesProcessorTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesProcessorTests.java @@ -28,8 +28,8 @@ import static org.junit.Assume.assumeNoException; * * @author Phillip Webb */ -public class JavaCompilerFieldValuesProcessorTests extends - AbstractFieldValuesProcessorTests { +public class JavaCompilerFieldValuesProcessorTests + extends AbstractFieldValuesProcessorTests { @Override protected FieldValuesParser createProcessor(ProcessingEnvironment env) { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadataTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadataTests.java index 326d88049e9..60c4228f95e 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadataTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadataTests.java @@ -40,7 +40,8 @@ public class ConfigurationMetadataTests { @Test public void toDashedCaseWordsSeveralUnderScores() { - assertThat(toDashedCase("Word___With__underscore"), is("word___with__underscore")); + assertThat(toDashedCase("Word___With__underscore"), + is("word___with__underscore")); } @Test diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java index 0baf41aeb35..c975032bade 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java @@ -21,8 +21,8 @@ package org.springframework.boot.configurationsample.simple; * * @author Stephane Nicoll */ -public abstract class HierarchicalPropertiesParent extends - HierarchicalPropertiesGrandparent { +public abstract class HierarchicalPropertiesParent + extends HierarchicalPropertiesGrandparent { private String second; diff --git a/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java b/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java index 3602a9521cf..23d24da53de 100644 --- a/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java +++ b/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java @@ -105,8 +105,8 @@ public abstract class ManagedDependencies implements Dependencies { */ public static ManagedDependencies get( Collection<Dependencies> versionManagedDependencies) { - return new ManagedDependencies(new ManagedDependenciesDelegate( - versionManagedDependencies)) { + return new ManagedDependencies( + new ManagedDependenciesDelegate(versionManagedDependencies)) { }; } diff --git a/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java b/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java index 0e322ce53e5..027fc5cab64 100644 --- a/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java +++ b/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java @@ -30,10 +30,10 @@ public class ManagedDependenciesDelegateTests { @Before public void setup() throws Exception { - PropertiesFileDependencies root = new PropertiesFileDependencies(getClass() - .getResourceAsStream("external.properties")); - PropertiesFileDependencies extra = new PropertiesFileDependencies(getClass() - .getResourceAsStream("additional-external.properties")); + PropertiesFileDependencies root = new PropertiesFileDependencies( + getClass().getResourceAsStream("external.properties")); + PropertiesFileDependencies extra = new PropertiesFileDependencies( + getClass().getResourceAsStream("additional-external.properties")); this.dependencies = new ManagedDependenciesDelegate(root, Collections.<Dependencies> singleton(extra)); } diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/FileUtils.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/FileUtils.java index 6500e233ee8..0b0535e2bc9 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/FileUtils.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/FileUtils.java @@ -64,8 +64,8 @@ public abstract class FileUtils { */ public static String sha1Hash(File file) throws IOException { try { - DigestInputStream inputStream = new DigestInputStream(new FileInputStream( - file), MessageDigest.getInstance("SHA-1")); + DigestInputStream inputStream = new DigestInputStream( + new FileInputStream(file), MessageDigest.getInstance("SHA-1")); try { byte[] buffer = new byte[4098]; while (inputStream.read(buffer) != -1) { 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 c0b729ea421..c1b7aae9293 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 @@ -198,8 +198,8 @@ public class JarWriter { */ public void writeLoaderClasses() throws IOException { URL loaderJar = getClass().getClassLoader().getResource(NESTED_LOADER_JAR); - JarInputStream inputStream = new JarInputStream(new BufferedInputStream( - loaderJar.openStream())); + JarInputStream inputStream = new JarInputStream( + new BufferedInputStream(loaderJar.openStream())); JarEntry entry; while ((entry = inputStream.getNextJarEntry()) != null) { if (entry.getName().endsWith(".class")) { @@ -323,8 +323,8 @@ public class JarWriter { @Override public int read(byte[] b, int off, int len) throws IOException { - int read = (this.headerStream == null ? -1 : this.headerStream.read(b, off, - len)); + int read = (this.headerStream == null ? -1 + : this.headerStream.read(b, off, len)); if (read != -1) { this.headerStream = null; return read; diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JvmUtils.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JvmUtils.java index 9c733d75ffd..1f6b80c9c63 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JvmUtils.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JvmUtils.java @@ -31,8 +31,8 @@ abstract class JvmUtils { /** * Various search locations for tools, including the odd Java 6 OSX jar. */ - private static final String[] TOOLS_LOCATIONS = { "lib/tools.jar", - "../lib/tools.jar", "../Classes/classes.jar" }; + private static final String[] TOOLS_LOCATIONS = { "lib/tools.jar", "../lib/tools.jar", + "../Classes/classes.jar" }; public static ClassLoader getToolsClassLoader() { ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java index 344d5dfee4a..a4505a83dd2 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java @@ -119,6 +119,7 @@ public final class Layouts { public static class War implements Layout { private static final Map<LibraryScope, String> SCOPE_DESTINATIONS; + static { Map<LibraryScope, String> map = new HashMap<LibraryScope, String>(); map.put(LibraryScope.COMPILE, "WEB-INF/lib/"); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java index 94dc3ad3031..d9d09426368 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java @@ -114,7 +114,8 @@ public abstract class MainClassFinder { return null; // nothing to do } if (!rootFolder.isDirectory()) { - throw new IllegalArgumentException("Invalid root folder '" + rootFolder + "'"); + throw new IllegalArgumentException( + "Invalid root folder '" + rootFolder + "'"); } String prefix = rootFolder.getAbsolutePath() + "/"; Deque<File> stack = new ArrayDeque<File>(); @@ -232,7 +233,8 @@ public abstract class MainClassFinder { return name; } - private static List<JarEntry> getClassEntries(JarFile source, String classesLocation) { + private static List<JarEntry> getClassEntries(JarFile source, + String classesLocation) { classesLocation = (classesLocation != null ? classesLocation : ""); Enumeration<JarEntry> sourceEntries = source.entries(); List<JarEntry> classEntries = new ArrayList<JarEntry>(); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java index 1214260207a..6391e94fe97 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java @@ -132,8 +132,8 @@ public class Repackager { destination = destination.getAbsoluteFile(); File workingSource = this.source; if (this.source.equals(destination)) { - workingSource = new File(this.source.getParentFile(), this.source.getName() - + ".original"); + workingSource = new File(this.source.getParentFile(), + this.source.getName() + ".original"); workingSource.delete(); renameFile(this.source, workingSource); } @@ -158,8 +158,8 @@ public class Repackager { JarFile jarFile = new JarFile(this.source); try { Manifest manifest = jarFile.getManifest(); - return (manifest != null && manifest.getMainAttributes().getValue( - BOOT_VERSION_ATTRIBUTE) != null); + return (manifest != null && manifest.getMainAttributes() + .getValue(BOOT_VERSION_ATTRIBUTE) != null); } finally { jarFile.close(); @@ -208,12 +208,12 @@ public class Repackager { private void writeNestedLibraries(List<Library> libraries, Set<String> alreadySeen, JarWriter writer) throws IOException { for (Library library : libraries) { - String destination = Repackager.this.layout.getLibraryDestination( - library.getName(), library.getScope()); + String destination = Repackager.this.layout + .getLibraryDestination(library.getName(), library.getScope()); if (destination != null) { if (!alreadySeen.add(destination + library.getName())) { - throw new IllegalStateException("Duplicate library " - + library.getName()); + throw new IllegalStateException( + "Duplicate library " + library.getName()); } writer.writeNestedLibrary(destination, library); } @@ -260,8 +260,8 @@ public class Repackager { } String launcherClassName = this.layout.getLauncherClassName(); if (launcherClassName != null) { - manifest.getMainAttributes() - .putValue(MAIN_CLASS_ATTRIBUTE, launcherClassName); + manifest.getMainAttributes().putValue(MAIN_CLASS_ATTRIBUTE, + launcherClassName); if (startClass == null) { throw new IllegalStateException("Unable to find main class"); } @@ -282,8 +282,8 @@ public class Repackager { private void renameFile(File file, File dest) { if (!file.renameTo(dest)) { - throw new IllegalStateException("Unable to rename '" + file + "' to '" + dest - + "'"); + throw new IllegalStateException( + "Unable to rename '" + file + "' to '" + dest + "'"); } } diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java index 2396e0e4ee6..e40c698490b 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java @@ -36,8 +36,8 @@ import org.springframework.util.ReflectionUtils; */ public class RunProcess { - private static final Method INHERIT_IO_METHOD = ReflectionUtils.findMethod( - ProcessBuilder.class, "inheritIO"); + private static final Method INHERIT_IO_METHOD = ReflectionUtils + .findMethod(ProcessBuilder.class, "inheritIO"); private static final long JUST_ENDED_LIMIT = 500; @@ -131,8 +131,8 @@ public class RunProcess { } private void redirectOutput(Process process) { - final BufferedReader reader = new BufferedReader(new InputStreamReader( - process.getInputStream())); + final BufferedReader reader = new BufferedReader( + new InputStreamReader(process.getInputStream())); new Thread() { @Override diff --git a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java index 25cd327de32..10db5bca0f1 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java @@ -91,8 +91,8 @@ public class MainClassFinderTests { public void findMainClassInJarSubLocation() throws Exception { this.testJarFile.addClass("a/B.class", ClassWithMainMethod.class); this.testJarFile.addClass("a/b/c/E.class", ClassWithMainMethod.class); - String actual = MainClassFinder - .findMainClass(this.testJarFile.getJarFile(), "a/"); + String actual = MainClassFinder.findMainClass(this.testJarFile.getJarFile(), + "a/"); assertThat(actual, equalTo("B")); } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java index 8fe40b58303..e8d2b8b8a8e 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java @@ -190,7 +190,8 @@ public class LaunchedURLClassLoader extends URLClassLoader { // manifest if (jarFile.getJarEntryData(path) != null && jarFile.getManifest() != null) { - definePackage(packageName, jarFile.getManifest(), url); + definePackage(packageName, jarFile.getManifest(), + url); return null; } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java index 29c01b57378..3bcd43ac948 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java @@ -149,7 +149,8 @@ public abstract class Launcher { throw new IllegalStateException( "Unable to determine code source archive from " + root); } - return (root.isDirectory() ? new ExplodedArchive(root) : new JarFileArchive(root)); + return (root.isDirectory() ? new ExplodedArchive(root) + : new JarFileArchive(root)); } } 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 3aef0ae070e..feb7847b2fa 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 @@ -47,8 +47,8 @@ public class MainMethodRunner implements Runnable { .loadClass(this.mainClassName); Method mainMethod = mainClass.getDeclaredMethod("main", String[].class); if (mainMethod == null) { - throw new IllegalStateException(this.mainClassName - + " does not have a main method"); + throw new IllegalStateException( + this.mainClassName + " does not have a main method"); } mainMethod.invoke(null, new Object[] { this.args }); } 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 52db6bf55ce..a2a8059b2ca 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 @@ -169,16 +169,17 @@ public class PropertiesLauncher extends Launcher { } protected File getHomeDirectory() { - return new File(SystemPropertyUtils.resolvePlaceholders(System.getProperty(HOME, - "${user.dir}"))); + return new File(SystemPropertyUtils + .resolvePlaceholders(System.getProperty(HOME, "${user.dir}"))); } private void initializeProperties(File home) throws Exception, IOException { String config = "classpath:" - + SystemPropertyUtils.resolvePlaceholders(SystemPropertyUtils - .getProperty(CONFIG_NAME, "application")) + ".properties"; - config = SystemPropertyUtils.resolvePlaceholders(SystemPropertyUtils.getProperty( - CONFIG_LOCATION, config)); + + SystemPropertyUtils.resolvePlaceholders( + SystemPropertyUtils.getProperty(CONFIG_NAME, "application")) + + ".properties"; + config = SystemPropertyUtils.resolvePlaceholders( + SystemPropertyUtils.getProperty(CONFIG_LOCATION, config)); InputStream resource = getResource(config); if (resource != null) { @@ -197,8 +198,9 @@ public class PropertiesLauncher extends Launcher { this.properties.put(key, value); } } - if (SystemPropertyUtils.resolvePlaceholders( - "${" + SET_SYSTEM_PROPERTIES + ":false}").equals("true")) { + if (SystemPropertyUtils + .resolvePlaceholders("${" + SET_SYSTEM_PROPERTIES + ":false}") + .equals("true")) { this.logger.info("Adding resolved properties to System properties"); for (Object key : Collections.list(this.properties.propertyNames())) { String value = this.properties.getProperty((String) key); @@ -277,8 +279,8 @@ public class PropertiesLauncher extends Launcher { // Try a URL connection content-length header... URLConnection connection = url.openConnection(); try { - connection.setUseCaches(connection.getClass().getSimpleName() - .startsWith("JNLP")); + connection.setUseCaches( + connection.getClass().getSimpleName().startsWith("JNLP")); if (connection instanceof HttpURLConnection) { HttpURLConnection httpConnection = (HttpURLConnection) connection; httpConnection.setRequestMethod("HEAD"); @@ -305,7 +307,8 @@ public class PropertiesLauncher extends Launcher { path = this.properties.getProperty(PATH); } if (path != null) { - this.paths = parsePathsProperty(SystemPropertyUtils.resolvePlaceholders(path)); + this.paths = parsePathsProperty( + SystemPropertyUtils.resolvePlaceholders(path)); } this.logger.info("Nested archive paths: " + this.paths); } @@ -343,8 +346,8 @@ public class PropertiesLauncher extends Launcher { protected String getMainClass() throws Exception { String mainClass = getProperty(MAIN, "Start-Class"); if (mainClass == null) { - throw new IllegalStateException("No '" + MAIN - + "' or 'Start-Class' specified"); + throw new IllegalStateException( + "No '" + MAIN + "' or 'Start-Class' specified"); } return mainClass; } @@ -364,8 +367,8 @@ public class PropertiesLauncher extends Launcher { private ClassLoader wrapWithCustomClassLoader(ClassLoader parent, String loaderClassName) throws Exception { - Class<ClassLoader> loaderClass = (Class<ClassLoader>) Class.forName( - loaderClassName, true, parent); + Class<ClassLoader> loaderClass = (Class<ClassLoader>) Class + .forName(loaderClassName, true, parent); try { return loaderClass.getConstructor(ClassLoader.class).newInstance(parent); @@ -403,8 +406,8 @@ public class PropertiesLauncher extends Launcher { } if (this.properties.containsKey(propertyKey)) { - String value = SystemPropertyUtils.resolvePlaceholders(this.properties - .getProperty(propertyKey)); + String value = SystemPropertyUtils + .resolvePlaceholders(this.properties.getProperty(propertyKey)); this.logger.fine("Property '" + propertyKey + "' from properties: " + value); return value; } @@ -428,8 +431,8 @@ public class PropertiesLauncher extends Launcher { if (manifest != null) { String value = manifest.getMainAttributes().getValue(manifestKey); if (value != null) { - this.logger.fine("Property '" + manifestKey + "' from archive manifest: " - + value); + this.logger.fine( + "Property '" + manifestKey + "' from archive manifest: " + value); return value; } } @@ -465,14 +468,14 @@ public class PropertiesLauncher extends Launcher { } Archive archive = getArchive(file); if (archive != null) { - this.logger.info("Adding classpath entries from archive " + archive.getUrl() - + root); + this.logger.info( + "Adding classpath entries from archive " + archive.getUrl() + root); lib.add(archive); } Archive nested = getNestedArchive(root); if (nested != null) { - this.logger.info("Adding classpath entries from nested " + nested.getUrl() - + root); + this.logger.info( + "Adding classpath entries from nested " + nested.getUrl() + root); lib.add(nested); } return lib; @@ -506,8 +509,8 @@ public class PropertiesLauncher extends Launcher { return new FilteredArchive(this.parent, filter); } - private void addParentClassLoaderEntries(List<Archive> lib) throws IOException, - URISyntaxException { + private void addParentClassLoaderEntries(List<Archive> lib) + throws IOException, URISyntaxException { ClassLoader parentClassLoader = getClass().getClassLoader(); List<Archive> urls = new ArrayList<Archive>(); for (URL url : getURLs(parentClassLoader)) { @@ -518,8 +521,8 @@ public class PropertiesLauncher extends Launcher { String name = url.getFile(); File dir = new File(name.substring(0, name.length() - 1)); if (dir.exists()) { - urls.add(new ExplodedArchive(new File(name.substring(0, - name.length() - 1)), false)); + urls.add(new ExplodedArchive( + new File(name.substring(0, name.length() - 1)), false)); } } else { 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 5fa1ec63ece..421da2ddcce 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 @@ -44,8 +44,8 @@ import org.springframework.boot.loader.util.AsciiBytes; */ public class ExplodedArchive extends Archive { - private static final Set<String> SKIPPED_NAMES = new HashSet<String>(Arrays.asList( - ".", "..")); + private static final Set<String> SKIPPED_NAMES = new HashSet<String>( + Arrays.asList(".", "..")); private static final AsciiBytes MANIFEST_ENTRY_NAME = new AsciiBytes( "META-INF/MANIFEST.MF"); @@ -152,7 +152,8 @@ public class ExplodedArchive extends Archive { protected Archive getNestedArchive(Entry entry) throws IOException { File file = ((FileEntry) entry).getFile(); - return (file.isDirectory() ? new ExplodedArchive(file) : new JarFileArchive(file)); + return (file.isDirectory() ? new ExplodedArchive(file) + : new JarFileArchive(file)); } @Override @@ -201,8 +202,8 @@ public class ExplodedArchive extends Archive { @Override protected URLConnection openConnection(URL url) throws IOException { - String name = url.getPath().substring( - ExplodedArchive.this.root.toURI().getPath().length()); + String name = url.getPath() + .substring(ExplodedArchive.this.root.toURI().getPath().length()); if (ExplodedArchive.this.entries.containsKey(new AsciiBytes(name))) { return new URL(url.toString()).openConnection(); } 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 bbc0692535d..1289fca026d 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 @@ -85,8 +85,8 @@ public class FilteredArchive extends Archive { return this.parent.getFilteredArchive(new EntryRenameFilter() { @Override public AsciiBytes apply(AsciiBytes entryName, Entry entry) { - return FilteredArchive.this.filter.matches(entry) ? filter.apply( - entryName, entry) : null; + return FilteredArchive.this.filter.matches(entry) + ? filter.apply(entryName, entry) : null; } }); } 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 f4ed545d15c..5dd3d12e83a 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 @@ -248,8 +248,9 @@ public class RandomAccessDataFile implements RandomAccessData { try { this.available.acquire(); RandomAccessFile file = this.files.poll(); - return (file == null ? new RandomAccessFile( - RandomAccessDataFile.this.file, "r") : file); + return (file == null + ? new RandomAccessFile(RandomAccessDataFile.this.file, "r") + : file); } catch (InterruptedException ex) { throw new IOException(ex); diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java index a3d5d792fc4..04fd9410883 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java @@ -82,8 +82,8 @@ class CentralDirectoryEndRecord { return false; } // Total size must be the structure size + comment - long commentLength = Bytes.littleEndianValue(this.block, this.offset - + COMMENT_LENGTH_OFFSET, 2); + long commentLength = Bytes.littleEndianValue(this.block, + this.offset + COMMENT_LENGTH_OFFSET, 2); return this.size == MINIMUM_SIZE + commentLength; } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java index 3fde7aece99..04d2595f6b8 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java @@ -45,14 +45,16 @@ public class Handler extends URLStreamHandler { private static final String SEPARATOR = "!/"; - private static final String[] FALLBACK_HANDLERS = { "sun.net.www.protocol.jar.Handler" }; + private static final String[] FALLBACK_HANDLERS = { + "sun.net.www.protocol.jar.Handler" }; private static final Method OPEN_CONNECTION_METHOD; + static { Method method = null; try { - method = URLStreamHandler.class - .getDeclaredMethod("openConnection", URL.class); + method = URLStreamHandler.class.getDeclaredMethod("openConnection", + URL.class); } catch (Exception ex) { // Swallow and ignore @@ -61,6 +63,7 @@ public class Handler extends URLStreamHandler { } private static SoftReference<Map<File, JarFile>> rootFileCache; + static { rootFileCache = new SoftReference<Map<File, JarFile>>(null); } @@ -187,7 +190,8 @@ public class Handler extends URLStreamHandler { * which are then swallowed. * @param useFastConnectionExceptions if fast connection exceptions can be used. */ - public static void setUseFastConnectionExceptions(boolean useFastConnectionExceptions) { + public static void setUseFastConnectionExceptions( + boolean useFastConnectionExceptions) { JarURLConnection.setUseFastExceptions(useFastConnectionExceptions); } 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 d46d31bcd44..ed3b7c5af17 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 @@ -108,13 +108,13 @@ public final class JarEntryData { // aspectjrt-1.7.4.jar has a different ext bytes length in the // local directory to the central directory. We need to re-read // here to skip them - byte[] localHeader = Bytes.get(this.source.getData().getSubsection( - this.localHeaderOffset, LOCAL_FILE_HEADER_SIZE)); + byte[] localHeader = Bytes.get(this.source.getData() + .getSubsection(this.localHeaderOffset, LOCAL_FILE_HEADER_SIZE)); long nameLength = Bytes.littleEndianValue(localHeader, 26, 2); long extraLength = Bytes.littleEndianValue(localHeader, 28, 2); - this.data = this.source.getData().getSubsection( - this.localHeaderOffset + LOCAL_FILE_HEADER_SIZE + nameLength - + extraLength, getCompressedSize()); + this.data = this.source.getData().getSubsection(this.localHeaderOffset + + LOCAL_FILE_HEADER_SIZE + nameLength + extraLength, + getCompressedSize()); } return this.data; } @@ -155,8 +155,8 @@ public final class JarEntryData { } /** - * Decode MSDOS Date Time details. See <a - * href="http://mindprod.com/jgloss/zip.html">mindprod.com/jgloss/zip.html</a> for + * Decode MSDOS Date Time details. See + * <a href="http://mindprod.com/jgloss/zip.html">mindprod.com/jgloss/zip.html</a> for * more details of the format. * @param date the date part * @param time the time part 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 3d6f3cdf092..3ec99a16e03 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 @@ -124,7 +124,7 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD private JarFile(RandomAccessDataFile rootFile, String pathFromRoot, RandomAccessData data, List<JarEntryData> entries, JarEntryFilter... filters) - throws IOException { + throws IOException { super(rootFile.getFile()); this.rootFile = rootFile; this.pathFromRoot = pathFromRoot; @@ -167,7 +167,8 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD for (JarEntryData entry : entries) { AsciiBytes name = entry.getName(); for (JarEntryFilter filter : filters) { - name = (filter == null || name == null ? name : filter.apply(name, entry)); + name = (filter == null || name == null ? name + : filter.apply(name, entry)); } if (name != null) { JarEntryData filteredCopy = entry.createFilteredCopy(this, name); @@ -291,8 +292,8 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD // Fallback to JarInputStream to obtain certificates, not fast but hopefully not // happening that often. try { - JarInputStream inputStream = new JarInputStream(getData().getInputStream( - ResourceAccess.ONCE)); + JarInputStream inputStream = new JarInputStream( + getData().getInputStream(ResourceAccess.ONCE)); try { java.util.jar.JarEntry entry = inputStream.getNextJarEntry(); while (entry != null) { @@ -343,8 +344,8 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD return sourceEntry.nestedJar; } catch (IOException ex) { - throw new IOException("Unable to open nested jar file '" - + sourceEntry.getName() + "'", ex); + throw new IOException( + "Unable to open nested jar file '" + sourceEntry.getName() + "'", ex); } } @@ -367,9 +368,10 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD return null; } }; - return new JarFile(this.rootFile, this.pathFromRoot + "!/" - + sourceEntry.getName().substring(0, sourceName.length() - 1), this.data, - this.entries, filter); + return new JarFile(this.rootFile, + this.pathFromRoot + "!/" + + sourceEntry.getName().substring(0, sourceName.length() - 1), + this.data, this.entries, filter); } private JarFile createJarFileFromFileEntry(JarEntryData sourceEntry) @@ -380,8 +382,8 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD + "jar files must be stored without compression. Please check the " + "mechanism used to create your executable jar file"); } - return new JarFile(this.rootFile, this.pathFromRoot + "!/" - + sourceEntry.getName(), sourceEntry.getData()); + return new JarFile(this.rootFile, + this.pathFromRoot + "!/" + sourceEntry.getName(), sourceEntry.getData()); } /** diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java index 0064090fb2e..d2c9a62a6dd 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java @@ -101,8 +101,8 @@ class JarURLConnection extends java.net.JarURLConnection { @Override public void connect() throws IOException { if (!this.jarEntryName.isEmpty()) { - this.jarEntryData = this.jarFile.getJarEntryData(this.jarEntryName - .asAsciiBytes()); + this.jarEntryData = this.jarFile + .getJarEntryData(this.jarEntryName.asAsciiBytes()); if (this.jarEntryData == null) { throwFileNotFound(this.jarEntryName, this.jarFile); } @@ -115,8 +115,8 @@ class JarURLConnection extends java.net.JarURLConnection { if (Boolean.TRUE.equals(useFastExceptions.get())) { throw FILE_NOT_FOUND_EXCEPTION; } - throw new FileNotFoundException("JAR entry " + entry + " not found in " - + jarFile.getName()); + throw new FileNotFoundException( + "JAR entry " + entry + " not found in " + jarFile.getName()); } @Override @@ -247,8 +247,8 @@ class JarURLConnection extends java.net.JarURLConnection { int hi = Character.digit(source.charAt(i + 1), 16); int lo = Character.digit(source.charAt(i + 2), 16); if (hi == -1 || lo == -1) { - throw new IllegalArgumentException("Invalid encoded sequence \"" - + source.substring(i) + "\""); + throw new IllegalArgumentException( + "Invalid encoded sequence \"" + source.substring(i) + "\""); } return ((char) ((hi << 4) + lo)); } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/AsciiBytes.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/AsciiBytes.java index 8b10a997fbd..1b44675bf90 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/AsciiBytes.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/AsciiBytes.java @@ -101,8 +101,8 @@ public final class AsciiBytes { return false; } for (int i = 0; i < postfix.length; i++) { - if (this.bytes[this.offset + (this.length - 1) - i] != postfix.bytes[postfix.offset - + (postfix.length - 1) - i]) { + if (this.bytes[this.offset + (this.length - 1) + - i] != postfix.bytes[postfix.offset + (postfix.length - 1) - i]) { return false; } } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java index 7c218154fee..27cb0f3ec89 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java @@ -96,8 +96,8 @@ public abstract class SystemPropertyUtils { while (startIndex != -1) { int endIndex = findPlaceholderEndIndex(buf, startIndex); if (endIndex != -1) { - String placeholder = buf.substring( - startIndex + PLACEHOLDER_PREFIX.length(), endIndex); + String placeholder = buf + .substring(startIndex + PLACEHOLDER_PREFIX.length(), endIndex); String originalPlaceholder = placeholder; if (!visitedPlaceholders.add(originalPlaceholder)) { throw new IllegalArgumentException("Circular placeholder reference '" @@ -115,9 +115,10 @@ public abstract class SystemPropertyUtils { if (separatorIndex != -1) { String actualPlaceholder = placeholder.substring(0, separatorIndex); - String defaultValue = placeholder.substring(separatorIndex - + VALUE_SEPARATOR.length()); - propVal = resolvePlaceholder(properties, value, actualPlaceholder); + String defaultValue = placeholder + .substring(separatorIndex + VALUE_SEPARATOR.length()); + propVal = resolvePlaceholder(properties, value, + actualPlaceholder); if (propVal == null) { propVal = defaultValue; } @@ -135,8 +136,8 @@ public abstract class SystemPropertyUtils { } else { // Proceed with unprocessed value. - startIndex = buf.indexOf(PLACEHOLDER_PREFIX, endIndex - + PLACEHOLDER_SUFFIX.length()); + startIndex = buf.indexOf(PLACEHOLDER_PREFIX, + endIndex + PLACEHOLDER_SUFFIX.length()); } visitedPlaceholders.remove(originalPlaceholder); } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/InputArgumentsJavaAgentDetectorTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/InputArgumentsJavaAgentDetectorTests.java index b42e4c2c364..f4d930a992c 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/InputArgumentsJavaAgentDetectorTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/InputArgumentsJavaAgentDetectorTests.java @@ -34,38 +34,39 @@ import static org.junit.Assert.assertTrue; public class InputArgumentsJavaAgentDetectorTests { @Test - public void nonAgentJarsDoNotProduceFalsePositives() throws MalformedURLException, - IOException { + public void nonAgentJarsDoNotProduceFalsePositives() + throws MalformedURLException, IOException { InputArgumentsJavaAgentDetector detector = new InputArgumentsJavaAgentDetector( Arrays.asList("-javaagent:my-agent.jar")); - assertFalse(detector.isJavaAgentJar(new File("something-else.jar") - .getCanonicalFile().toURI().toURL())); + assertFalse(detector.isJavaAgentJar( + new File("something-else.jar").getCanonicalFile().toURI().toURL())); } @Test public void singleJavaAgent() throws MalformedURLException, IOException { InputArgumentsJavaAgentDetector detector = new InputArgumentsJavaAgentDetector( Arrays.asList("-javaagent:my-agent.jar")); - assertTrue(detector.isJavaAgentJar(new File("my-agent.jar").getCanonicalFile() - .toURI().toURL())); + assertTrue(detector.isJavaAgentJar( + new File("my-agent.jar").getCanonicalFile().toURI().toURL())); } @Test public void singleJavaAgentWithOptions() throws MalformedURLException, IOException { InputArgumentsJavaAgentDetector detector = new InputArgumentsJavaAgentDetector( Arrays.asList("-javaagent:my-agent.jar=a=alpha,b=bravo")); - assertTrue(detector.isJavaAgentJar(new File("my-agent.jar").getCanonicalFile() - .toURI().toURL())); + assertTrue(detector.isJavaAgentJar( + new File("my-agent.jar").getCanonicalFile().toURI().toURL())); } @Test public void multipleJavaAgents() throws MalformedURLException, IOException { InputArgumentsJavaAgentDetector detector = new InputArgumentsJavaAgentDetector( - Arrays.asList("-javaagent:my-agent.jar", "-javaagent:my-other-agent.jar")); - assertTrue(detector.isJavaAgentJar(new File("my-agent.jar").getCanonicalFile() - .toURI().toURL())); - assertTrue(detector.isJavaAgentJar(new File("my-other-agent.jar") - .getCanonicalFile().toURI().toURL())); + Arrays.asList("-javaagent:my-agent.jar", + "-javaagent:my-other-agent.jar")); + assertTrue(detector.isJavaAgentJar( + new File("my-agent.jar").getCanonicalFile().toURI().toURL())); + assertTrue(detector.isJavaAgentJar( + new File("my-other-agent.jar").getCanonicalFile().toURI().toURL())); } } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/LaunchedURLClassLoaderTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/LaunchedURLClassLoaderTests.java index 1ffe87ea383..fed4cd8d24a 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/LaunchedURLClassLoaderTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/LaunchedURLClassLoaderTests.java @@ -46,44 +46,44 @@ public class LaunchedURLClassLoaderTests { public void resolveResourceFromWindowsFilesystem() throws Exception { // This path is invalid - it should return null even on Windows. // A regular URLClassLoader will deal with it gracefully. - assertNull(getClass().getClassLoader().getResource( - "c:\\Users\\user\\bar.properties")); - LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { new URL( - "jar:file:src/test/resources/jars/app.jar!/") }, getClass() - .getClassLoader()); + assertNull(getClass().getClassLoader() + .getResource("c:\\Users\\user\\bar.properties")); + LaunchedURLClassLoader loader = new LaunchedURLClassLoader( + new URL[] { new URL("jar:file:src/test/resources/jars/app.jar!/") }, + getClass().getClassLoader()); // So we should too... assertNull(loader.getResource("c:\\Users\\user\\bar.properties")); } @Test public void resolveResourceFromArchive() throws Exception { - LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { new URL( - "jar:file:src/test/resources/jars/app.jar!/") }, getClass() - .getClassLoader()); + LaunchedURLClassLoader loader = new LaunchedURLClassLoader( + new URL[] { new URL("jar:file:src/test/resources/jars/app.jar!/") }, + getClass().getClassLoader()); assertNotNull(loader.getResource("demo/Application.java")); } @Test public void resolveResourcesFromArchive() throws Exception { - LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { new URL( - "jar:file:src/test/resources/jars/app.jar!/") }, getClass() - .getClassLoader()); + LaunchedURLClassLoader loader = new LaunchedURLClassLoader( + new URL[] { new URL("jar:file:src/test/resources/jars/app.jar!/") }, + getClass().getClassLoader()); assertTrue(loader.getResources("demo/Application.java").hasMoreElements()); } @Test public void resolveRootPathFromArchive() throws Exception { - LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { new URL( - "jar:file:src/test/resources/jars/app.jar!/") }, getClass() - .getClassLoader()); + LaunchedURLClassLoader loader = new LaunchedURLClassLoader( + new URL[] { new URL("jar:file:src/test/resources/jars/app.jar!/") }, + getClass().getClassLoader()); assertNotNull(loader.getResource("")); } @Test public void resolveRootResourcesFromArchive() throws Exception { - LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { new URL( - "jar:file:src/test/resources/jars/app.jar!/") }, getClass() - .getClassLoader()); + LaunchedURLClassLoader loader = new LaunchedURLClassLoader( + new URL[] { new URL("jar:file:src/test/resources/jars/app.jar!/") }, + getClass().getClassLoader()); assertTrue(loader.getResources("").hasMoreElements()); } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java index 917c4bbc8f2..ca1ff01cf3a 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java @@ -80,7 +80,8 @@ public class PropertiesLauncherTests { System.setProperty("loader.config.name", "foo"); PropertiesLauncher launcher = new PropertiesLauncher(); assertEquals("my.Application", launcher.getMainClass()); - assertEquals("[etc/]", ReflectionTestUtils.getField(launcher, "paths").toString()); + assertEquals("[etc/]", + ReflectionTestUtils.getField(launcher, "paths").toString()); } @Test @@ -95,8 +96,8 @@ public class PropertiesLauncherTests { System.setProperty("loader.path", "jars/*"); System.setProperty("loader.main", "demo.Application"); PropertiesLauncher launcher = new PropertiesLauncher(); - assertEquals("[jars/]", ReflectionTestUtils.getField(launcher, "paths") - .toString()); + assertEquals("[jars/]", + ReflectionTestUtils.getField(launcher, "paths").toString()); launcher.launch(new String[0]); waitFor("Hello World"); } @@ -106,8 +107,8 @@ public class PropertiesLauncherTests { System.setProperty("loader.path", "jars/app.jar"); System.setProperty("loader.main", "demo.Application"); PropertiesLauncher launcher = new PropertiesLauncher(); - assertEquals("[jars/app.jar]", ReflectionTestUtils.getField(launcher, "paths") - .toString()); + assertEquals("[jars/app.jar]", + ReflectionTestUtils.getField(launcher, "paths").toString()); launcher.launch(new String[0]); waitFor("Hello World"); } @@ -117,8 +118,8 @@ public class PropertiesLauncherTests { System.setProperty("loader.path", "./jars/app.jar"); System.setProperty("loader.main", "demo.Application"); PropertiesLauncher launcher = new PropertiesLauncher(); - assertEquals("[jars/app.jar]", ReflectionTestUtils.getField(launcher, "paths") - .toString()); + assertEquals("[jars/app.jar]", + ReflectionTestUtils.getField(launcher, "paths").toString()); launcher.launch(new String[0]); waitFor("Hello World"); } @@ -128,8 +129,8 @@ public class PropertiesLauncherTests { System.setProperty("loader.path", "jars/app.jar"); System.setProperty("loader.classLoader", URLClassLoader.class.getName()); PropertiesLauncher launcher = new PropertiesLauncher(); - assertEquals("[jars/app.jar]", ReflectionTestUtils.getField(launcher, "paths") - .toString()); + assertEquals("[jars/app.jar]", + ReflectionTestUtils.getField(launcher, "paths").toString()); launcher.launch(new String[0]); waitFor("Hello World"); } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/WarLauncherTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/WarLauncherTests.java index b7175cb6330..9d2efeb8cec 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/WarLauncherTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/WarLauncherTests.java @@ -65,10 +65,8 @@ public class WarLauncherTests { List<Archive> archives = launcher.getClassPathArchives(); assertEquals(2, archives.size()); - assertThat( - getUrls(archives), - hasItems(webInfClasses.toURI().toURL(), new URL("jar:" - + webInfLibFoo.toURI().toURL() + "!/"))); + assertThat(getUrls(archives), hasItems(webInfClasses.toURI().toURL(), + new URL("jar:" + webInfLibFoo.toURI().toURL() + "!/"))); } @Test @@ -80,12 +78,10 @@ public class WarLauncherTests { List<Archive> archives = launcher.getClassPathArchives(); assertEquals(2, archives.size()); - assertThat( - getUrls(archives), - hasItems( - new URL("jar:" + warRoot.toURI().toURL() + "!/WEB-INF/classes!/"), - new URL("jar:" + warRoot.toURI().toURL() - + "!/WEB-INF/lib/foo.jar!/"))); + assertThat(getUrls(archives), + hasItems(new URL("jar:" + warRoot.toURI().toURL() + + "!/WEB-INF/classes!/"), + new URL("jar:" + warRoot.toURI().toURL() + "!/WEB-INF/lib/foo.jar!/"))); } private Set<URL> getUrls(List<Archive> archives) throws MalformedURLException { @@ -100,8 +96,8 @@ public class WarLauncherTests { File warRoot = new File("target/archive.war"); warRoot.delete(); - JarOutputStream jarOutputStream = new JarOutputStream(new FileOutputStream( - warRoot)); + JarOutputStream jarOutputStream = new JarOutputStream( + new FileOutputStream(warRoot)); jarOutputStream.putNextEntry(new JarEntry("WEB-INF/")); jarOutputStream.putNextEntry(new JarEntry("WEB-INF/classes/")); diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java index 03c1f21ca59..01f47fb1093 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java @@ -69,8 +69,8 @@ public class ExplodedArchiveTests { Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); - File destination = new File(this.rootFolder.getAbsolutePath() - + File.separator + entry.getName()); + File destination = new File( + this.rootFolder.getAbsolutePath() + File.separator + entry.getName()); destination.getParentFile().mkdirs(); if (entry.isDirectory()) { destination.mkdir(); @@ -115,8 +115,8 @@ public class ExplodedArchiveTests { public void getNestedArchive() throws Exception { Entry entry = getEntriesMap(this.archive).get("nested.jar"); Archive nested = this.archive.getNestedArchive(entry); - assertThat(nested.getUrl().toString(), equalTo("jar:" + this.rootFolder.toURI() - + "nested.jar!/")); + assertThat(nested.getUrl().toString(), + equalTo("jar:" + this.rootFolder.toURI() + "nested.jar!/")); } @Test @@ -125,8 +125,8 @@ public class ExplodedArchiveTests { Archive nested = this.archive.getNestedArchive(entry); Map<String, Entry> nestedEntries = getEntriesMap(nested); assertThat(nestedEntries.size(), equalTo(1)); - assertThat(nested.getUrl().toString(), equalTo("file:" - + this.rootFolder.toURI().getPath() + "d/")); + assertThat(nested.getUrl().toString(), + equalTo("file:" + this.rootFolder.toURI().getPath() + "d/")); } @Test @@ -159,7 +159,8 @@ public class ExplodedArchiveTests { @Test public void getNonRecursiveManifest() throws Exception { - ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root")); + ExplodedArchive archive = new ExplodedArchive( + new File("src/test/resources/root")); assertNotNull(archive.getManifest()); Map<String, Archive.Entry> entries = getEntriesMap(archive); assertThat(entries.size(), equalTo(4)); @@ -167,8 +168,8 @@ public class ExplodedArchiveTests { @Test public void getNonRecursiveManifestEvenIfNonRecursive() throws Exception { - ExplodedArchive archive = new ExplodedArchive( - new File("src/test/resources/root"), false); + ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root"), + false); assertNotNull(archive.getManifest()); Map<String, Archive.Entry> entries = getEntriesMap(archive); assertThat(entries.size(), equalTo(3)); @@ -176,7 +177,8 @@ public class ExplodedArchiveTests { @Test public void getResourceAsStream() throws Exception { - ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root")); + ExplodedArchive archive = new ExplodedArchive( + new File("src/test/resources/root")); assertNotNull(archive.getManifest()); URLClassLoader loader = new URLClassLoader(new URL[] { archive.getUrl() }); assertNotNull(loader.getResourceAsStream("META-INF/spring/application.xml")); @@ -185,8 +187,8 @@ public class ExplodedArchiveTests { @Test public void getResourceAsStreamNonRecursive() throws Exception { - ExplodedArchive archive = new ExplodedArchive( - new File("src/test/resources/root"), false); + ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root"), + false); assertNotNull(archive.getManifest()); URLClassLoader loader = new URLClassLoader(new URL[] { archive.getUrl() }); assertNotNull(loader.getResourceAsStream("META-INF/spring/application.xml")); diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java index 2fe946ddeeb..8badf61e70b 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java @@ -85,8 +85,8 @@ public class JarFileArchiveTests { public void getNestedArchive() throws Exception { Entry entry = getEntriesMap(this.archive).get("nested.jar"); Archive nested = this.archive.getNestedArchive(entry); - assertThat(nested.getUrl().toString(), equalTo("jar:" + this.rootJarFileUrl - + "!/nested.jar!/")); + assertThat(nested.getUrl().toString(), + equalTo("jar:" + this.rootJarFileUrl + "!/nested.jar!/")); } @Test diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/ByteArrayRandomAccessDataTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/ByteArrayRandomAccessDataTests.java index 506dc47a03f..ed9c5f005e3 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/ByteArrayRandomAccessDataTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/ByteArrayRandomAccessDataTests.java @@ -34,8 +34,8 @@ public class ByteArrayRandomAccessDataTests { public void testGetInputStream() throws Exception { byte[] bytes = new byte[] { 0, 1, 2, 3, 4, 5 }; RandomAccessData data = new ByteArrayRandomAccessData(bytes); - assertThat(FileCopyUtils.copyToByteArray(data - .getInputStream(ResourceAccess.PER_READ)), equalTo(bytes)); + assertThat(FileCopyUtils.copyToByteArray( + data.getInputStream(ResourceAccess.PER_READ)), equalTo(bytes)); assertThat(data.getSize(), equalTo((long) bytes.length)); } @@ -44,8 +44,10 @@ public class ByteArrayRandomAccessDataTests { byte[] bytes = new byte[] { 0, 1, 2, 3, 4, 5 }; RandomAccessData data = new ByteArrayRandomAccessData(bytes); data = data.getSubsection(1, 4).getSubsection(1, 2); - assertThat(FileCopyUtils.copyToByteArray(data - .getInputStream(ResourceAccess.PER_READ)), equalTo(new byte[] { 2, 3 })); + assertThat( + FileCopyUtils + .copyToByteArray(data.getInputStream(ResourceAccess.PER_READ)), + equalTo(new byte[] { 2, 3 })); assertThat(data.getSize(), equalTo(2L)); } } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java index 4cf536455b4..3f80f9d1044 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java @@ -50,6 +50,7 @@ import static org.junit.Assert.assertThat; public class RandomAccessDataFileTests { private static final byte[] BYTES; + static { BYTES = new byte[256]; for (int i = 0; i < BYTES.length; i++) { @@ -212,7 +213,8 @@ public class RandomAccessDataFileTests { @Test public void subsectionZeroLength() throws Exception { RandomAccessData subsection = this.file.getSubsection(0, 0); - assertThat(subsection.getInputStream(ResourceAccess.PER_READ).read(), equalTo(-1)); + assertThat(subsection.getInputStream(ResourceAccess.PER_READ).read(), + equalTo(-1)); } @Test diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java index dfbbb7149a2..cd3fd14605d 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java @@ -152,8 +152,8 @@ public class JarFileTests { @Test public void getInputStream() throws Exception { - InputStream inputStream = this.jarFile.getInputStream(this.jarFile - .getEntry("1.dat")); + InputStream inputStream = this.jarFile + .getInputStream(this.jarFile.getEntry("1.dat")); assertThat(inputStream.available(), equalTo(1)); assertThat(inputStream.read(), equalTo(1)); assertThat(inputStream.available(), equalTo(0)); @@ -180,8 +180,8 @@ public class JarFileTests { @Test public void close() throws Exception { - RandomAccessDataFile randomAccessDataFile = spy(new RandomAccessDataFile( - this.rootJarFile, 1)); + RandomAccessDataFile randomAccessDataFile = spy( + new RandomAccessDataFile(this.rootJarFile, 1)); JarFile jarFile = new JarFile(randomAccessDataFile); jarFile.close(); verify(randomAccessDataFile).close(); @@ -204,7 +204,8 @@ public class JarFileTests { @Test public void createEntryUrl() throws Exception { URL url = new URL(this.jarFile.getUrl(), "1.dat"); - assertThat(url.toString(), equalTo("jar:" + this.rootJarFile.toURI() + "!/1.dat")); + assertThat(url.toString(), + equalTo("jar:" + this.rootJarFile.toURI() + "!/1.dat")); JarURLConnection jarURLConnection = (JarURLConnection) url.openConnection(); assertThat(jarURLConnection.getJarFile(), sameInstance(this.jarFile)); assertThat(jarURLConnection.getJarEntry(), @@ -217,8 +218,8 @@ public class JarFileTests { @Test public void getMissingEntryUrl() throws Exception { URL url = new URL(this.jarFile.getUrl(), "missing.dat"); - assertThat(url.toString(), equalTo("jar:" + this.rootJarFile.toURI() - + "!/missing.dat")); + assertThat(url.toString(), + equalTo("jar:" + this.rootJarFile.toURI() + "!/missing.dat")); this.thrown.expect(FileNotFoundException.class); ((JarURLConnection) url.openConnection()).getJarEntry(); } @@ -242,8 +243,8 @@ public class JarFileTests { @Test public void getNestedJarFile() throws Exception { - JarFile nestedJarFile = this.jarFile.getNestedJarFile(this.jarFile - .getEntry("nested.jar")); + JarFile nestedJarFile = this.jarFile + .getNestedJarFile(this.jarFile.getEntry("nested.jar")); Enumeration<java.util.jar.JarEntry> entries = nestedJarFile.entries(); assertThat(entries.nextElement().getName(), equalTo("META-INF/")); @@ -253,14 +254,14 @@ public class JarFileTests { assertThat(entries.nextElement().getName(), equalTo("\u00E4.dat")); assertThat(entries.hasMoreElements(), equalTo(false)); - InputStream inputStream = nestedJarFile.getInputStream(nestedJarFile - .getEntry("3.dat")); + InputStream inputStream = nestedJarFile + .getInputStream(nestedJarFile.getEntry("3.dat")); assertThat(inputStream.read(), equalTo(3)); assertThat(inputStream.read(), equalTo(-1)); URL url = nestedJarFile.getUrl(); - assertThat(url.toString(), equalTo("jar:" + this.rootJarFile.toURI() - + "!/nested.jar!/")); + assertThat(url.toString(), + equalTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar!/")); JarURLConnection conn = (JarURLConnection) url.openConnection(); assertThat(conn.getJarFile(), sameInstance(nestedJarFile)); assertThat(conn.getJarFileURL().toString(), @@ -276,8 +277,8 @@ public class JarFileTests { assertThat(entries.nextElement().getName(), equalTo("9.dat")); assertThat(entries.hasMoreElements(), equalTo(false)); - InputStream inputStream = nestedJarFile.getInputStream(nestedJarFile - .getEntry("9.dat")); + InputStream inputStream = nestedJarFile + .getInputStream(nestedJarFile.getEntry("9.dat")); assertThat(inputStream.read(), equalTo(9)); assertThat(inputStream.read(), equalTo(-1)); @@ -289,11 +290,11 @@ public class JarFileTests { @Test public void getNestJarEntryUrl() throws Exception { - JarFile nestedJarFile = this.jarFile.getNestedJarFile(this.jarFile - .getEntry("nested.jar")); + JarFile nestedJarFile = this.jarFile + .getNestedJarFile(this.jarFile.getEntry("nested.jar")); URL url = nestedJarFile.getJarEntry("3.dat").getUrl(); - assertThat(url.toString(), equalTo("jar:" + this.rootJarFile.toURI() - + "!/nested.jar!/3.dat")); + assertThat(url.toString(), + equalTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar!/3.dat")); InputStream inputStream = url.openStream(); assertThat(inputStream, notNullValue()); assertThat(inputStream.read(), equalTo(3)); @@ -310,8 +311,8 @@ public class JarFileTests { assertThat(inputStream.read(), equalTo(3)); JarURLConnection connection = (JarURLConnection) url.openConnection(); assertThat(connection.getURL().toString(), equalTo(spec)); - assertThat(connection.getJarFileURL().toString(), equalTo("jar:" - + this.rootJarFile.toURI() + "!/nested.jar")); + assertThat(connection.getJarFileURL().toString(), + equalTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar")); assertThat(connection.getEntryName(), equalTo("3.dat")); } @@ -360,8 +361,8 @@ public class JarFileTests { assertThat(entries.nextElement().getName(), equalTo("x.dat")); assertThat(entries.hasMoreElements(), equalTo(false)); - InputStream inputStream = filteredJarFile.getInputStream(filteredJarFile - .getEntry("x.dat")); + InputStream inputStream = filteredJarFile + .getInputStream(filteredJarFile.getEntry("x.dat")); assertThat(inputStream.read(), equalTo(1)); assertThat(inputStream.read(), equalTo(-1)); } @@ -369,8 +370,10 @@ public class JarFileTests { @Test public void sensibleToString() throws Exception { assertThat(this.jarFile.toString(), equalTo(this.rootJarFile.getPath())); - assertThat(this.jarFile.getNestedJarFile(this.jarFile.getEntry("nested.jar")) - .toString(), equalTo(this.rootJarFile.getPath() + "!/nested.jar")); + assertThat( + this.jarFile.getNestedJarFile(this.jarFile.getEntry("nested.jar")) + .toString(), + equalTo(this.rootJarFile.getPath() + "!/nested.jar")); } @Test @@ -418,8 +421,8 @@ public class JarFileTests { @Test public void cannotLoadMissingJar() throws Exception { // relates to gh-1070 - JarFile nestedJarFile = this.jarFile.getNestedJarFile(this.jarFile - .getEntry("nested.jar")); + JarFile nestedJarFile = this.jarFile + .getNestedJarFile(this.jarFile.getEntry("nested.jar")); URL nestedUrl = nestedJarFile.getUrl(); URL url = new URL(nestedUrl, nestedJarFile.getUrl() + "missing.jar!/3.dat"); this.thrown.expect(FileNotFoundException.class); diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/util/SystemPropertyUtilsTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/util/SystemPropertyUtilsTests.java index 96355eeed6c..17111bc1253 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/util/SystemPropertyUtilsTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/util/SystemPropertyUtilsTests.java @@ -49,7 +49,8 @@ public class SystemPropertyUtilsTests { @Test public void testNestedPlaceholder() { - assertEquals("foo", SystemPropertyUtils.resolvePlaceholders("${bar:${spam:foo}}")); + assertEquals("foo", + SystemPropertyUtils.resolvePlaceholders("${bar:${spam:foo}}")); } @Test diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java index 6856d67f142..91e75e10c4d 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java @@ -107,10 +107,10 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo { for (ArtifactsFilter additionalFilter : additionalFilters) { filters.addFilter(additionalFilter); } - filters.addFilter(new ArtifactIdFilter("", - cleanFilterConfig(this.excludeArtifactIds))); - filters.addFilter(new MatchingGroupIdFilter( - cleanFilterConfig(this.excludeGroupIds))); + filters.addFilter( + new ArtifactIdFilter("", cleanFilterConfig(this.excludeArtifactIds))); + filters.addFilter( + new MatchingGroupIdFilter(cleanFilterConfig(this.excludeGroupIds))); if (this.includes != null && !this.includes.isEmpty()) { filters.addFilter(new IncludeFilter(this.includes)); } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java index c301b385fed..ab14040e0db 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java @@ -41,6 +41,7 @@ import org.springframework.boot.loader.tools.LibraryScope; public class ArtifactsLibraries implements Libraries { private static final Map<String, LibraryScope> SCOPES; + static { Map<String, LibraryScope> scopes = new HashMap<String, LibraryScope>(); scopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE); 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 cd2521d9c34..56378d35bed 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 @@ -66,8 +66,8 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer String name = (String) key; String value = properties.getProperty(name); String existing = this.data.getProperty(name); - this.data - .setProperty(name, existing == null ? value : existing + "," + value); + this.data.setProperty(name, + existing == null ? value : existing + "," + value); } } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java index 57e252c745a..f81348b3fb6 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java @@ -58,8 +58,8 @@ class RunArguments { return CommandLineUtils.translateCommandline(arguments); } catch (Exception ex) { - throw new IllegalArgumentException("Failed to parse arguments [" + arguments - + "]", ex); + throw new IllegalArgumentException( + "Failed to parse arguments [" + arguments + "]", ex); } } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java index 9330379acf3..880e9c8b584 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java @@ -41,17 +41,17 @@ public class ExcludeFilterTests { @Test public void excludeSimple() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar"))); - Set result = filter.filter(Collections - .singleton(createArtifact("com.foo", "bar"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar"))); + Set result = filter + .filter(Collections.singleton(createArtifact("com.foo", "bar"))); assertEquals("Should have been filtered", 0, result.size()); } @Test public void excludeGroupIdNoMatch() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar"))); Artifact artifact = createArtifact("com.baz", "bar"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -60,8 +60,8 @@ public class ExcludeFilterTests { @Test public void excludeArtifactIdNoMatch() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar"))); Artifact artifact = createArtifact("com.foo", "biz"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -70,17 +70,17 @@ public class ExcludeFilterTests { @Test public void excludeClassifier() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar", "jdk5"))); - Set result = filter.filter(Collections.singleton(createArtifact("com.foo", "bar", - "jdk5"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar", "jdk5"))); + Set result = filter + .filter(Collections.singleton(createArtifact("com.foo", "bar", "jdk5"))); assertEquals("Should have been filtered", 0, result.size()); } @Test public void excludeClassifierNoTargetClassifier() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar", "jdk5"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar", "jdk5"))); Artifact artifact = createArtifact("com.foo", "bar"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -89,8 +89,8 @@ public class ExcludeFilterTests { @Test public void excludeClassifierNoMatch() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar", "jdk5"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar", "jdk5"))); Artifact artifact = createArtifact("com.foo", "bar", "jdk6"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -126,7 +126,8 @@ public class ExcludeFilterTests { return exclude; } - private Artifact createArtifact(String groupId, String artifactId, String classifier) { + private Artifact createArtifact(String groupId, String artifactId, + String classifier) { Artifact a = mock(Artifact.class); given(a.getGroupId()).willReturn(groupId); given(a.getArtifactId()).willReturn(artifactId); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java index 57ade6248ca..3f99067ff21 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java @@ -40,8 +40,8 @@ public class IncludeFilterTests { @Test public void includeSimple() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar"))); Artifact artifact = createArtifact("com.foo", "bar"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -50,8 +50,8 @@ public class IncludeFilterTests { @Test public void includeGroupIdNoMatch() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar"))); Artifact artifact = createArtifact("com.baz", "bar"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should have been filtered", 0, result.size()); @@ -59,8 +59,8 @@ public class IncludeFilterTests { @Test public void includeArtifactIdNoMatch() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar"))); Artifact artifact = createArtifact("com.foo", "biz"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should have been filtered", 0, result.size()); @@ -68,8 +68,8 @@ public class IncludeFilterTests { @Test public void includeClassifier() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar", "jdk5"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar", "jdk5"))); Artifact artifact = createArtifact("com.foo", "bar", "jdk5"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -78,8 +78,8 @@ public class IncludeFilterTests { @Test public void includeClassifierNoTargetClassifier() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar", "jdk5"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar", "jdk5"))); Artifact artifact = createArtifact("com.foo", "bar"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should have been filtered", 0, result.size()); @@ -87,8 +87,8 @@ public class IncludeFilterTests { @Test public void includeClassifierNoMatch() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar", "jdk5"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar", "jdk5"))); Artifact artifact = createArtifact("com.foo", "bar", "jdk6"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should have been filtered", 0, result.size()); @@ -122,7 +122,8 @@ public class IncludeFilterTests { return include; } - private Artifact createArtifact(String groupId, String artifactId, String classifier) { + private Artifact createArtifact(String groupId, String artifactId, + String classifier) { Artifact a = mock(Artifact.class); given(a.getGroupId()).willReturn(groupId); given(a.getArtifactId()).willReturn(artifactId); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/RunArgumentsTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/RunArgumentsTests.java index 57c3521abdf..89a6e107986 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/RunArgumentsTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/RunArgumentsTests.java @@ -44,7 +44,8 @@ public class RunArgumentsTests { @Test public void parseDebugFlags() { - String[] args = parseArgs("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"); + String[] args = parseArgs( + "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"); assertEquals(2, args.length); assertEquals("-Xdebug", args[0]); assertEquals("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005", 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 570be2f9e72..6af8ff6d02b 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 @@ -131,8 +131,8 @@ public final class Verify { return entry.getValue(); } } - throw new IllegalStateException("Unable to find entry starting with " - + entryName); + throw new IllegalStateException( + "Unable to find entry starting with " + entryName); } public boolean hasEntry(String entry) { @@ -225,16 +225,16 @@ public final class Verify { verifier.assertHasEntryNameStartingWith("lib/spring-context"); verifier.assertHasEntryNameStartingWith("lib/spring-core"); verifier.assertHasEntryNameStartingWith("lib/javax.servlet-api-3"); - assertTrue("Unpacked launcher classes", verifier.hasEntry("org/" - + "springframework/boot/loader/JarLauncher.class")); - assertTrue("Own classes", verifier.hasEntry("org/" - + "test/SampleApplication.class")); + assertTrue("Unpacked launcher classes", verifier + .hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")); + assertTrue("Own classes", + verifier.hasEntry("org/" + "test/SampleApplication.class")); } @Override protected void verifyManifest(Manifest manifest) throws Exception { - assertEquals("org.springframework.boot.loader.JarLauncher", manifest - .getMainAttributes().getValue("Main-Class")); + assertEquals("org.springframework.boot.loader.JarLauncher", + manifest.getMainAttributes().getValue("Main-Class")); assertEquals(this.main, manifest.getMainAttributes().getValue("Start-Class")); assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used")); } @@ -251,20 +251,21 @@ public final class Verify { super.verifyZipEntries(verifier); verifier.assertHasEntryNameStartingWith("WEB-INF/lib/spring-context"); verifier.assertHasEntryNameStartingWith("WEB-INF/lib/spring-core"); - verifier.assertHasEntryNameStartingWith("WEB-INF/lib-provided/javax.servlet-api-3"); - assertTrue("Unpacked launcher classes", verifier.hasEntry("org/" - + "springframework/boot/loader/JarLauncher.class")); - assertTrue("Own classes", verifier.hasEntry("WEB-INF/classes/org/" - + "test/SampleApplication.class")); + verifier.assertHasEntryNameStartingWith( + "WEB-INF/lib-provided/javax.servlet-api-3"); + assertTrue("Unpacked launcher classes", verifier + .hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")); + assertTrue("Own classes", verifier + .hasEntry("WEB-INF/classes/org/" + "test/SampleApplication.class")); assertTrue("Web content", verifier.hasEntry("index.html")); } @Override protected void verifyManifest(Manifest manifest) throws Exception { - assertEquals("org.springframework.boot.loader.WarLauncher", manifest - .getMainAttributes().getValue("Main-Class")); - assertEquals("org.test.SampleApplication", manifest.getMainAttributes() - .getValue("Start-Class")); + assertEquals("org.springframework.boot.loader.WarLauncher", + manifest.getMainAttributes().getValue("Main-Class")); + assertEquals("org.test.SampleApplication", + manifest.getMainAttributes().getValue("Start-Class")); assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used")); } } @@ -277,10 +278,10 @@ public final class Verify { @Override protected void verifyManifest(Manifest manifest) throws Exception { - assertEquals("org.springframework.boot.loader.PropertiesLauncher", manifest - .getMainAttributes().getValue("Main-Class")); - assertEquals("org.test.SampleApplication", manifest.getMainAttributes() - .getValue("Start-Class")); + assertEquals("org.springframework.boot.loader.PropertiesLauncher", + manifest.getMainAttributes().getValue("Main-Class")); + assertEquals("org.test.SampleApplication", + manifest.getMainAttributes().getValue("Start-Class")); assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used")); } } @@ -297,10 +298,10 @@ public final class Verify { verifier.assertHasEntryNameStartingWith("lib/spring-context"); verifier.assertHasEntryNameStartingWith("lib/spring-core"); verifier.assertHasNoEntryNameStartingWith("lib/javax.servlet-api-3"); - assertFalse("Unpacked launcher classes", verifier.hasEntry("org/" - + "springframework/boot/loader/JarLauncher.class")); - assertTrue("Own classes", verifier.hasEntry("org/" - + "test/SampleModule.class")); + assertFalse("Unpacked launcher classes", verifier + .hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")); + assertTrue("Own classes", + verifier.hasEntry("org/" + "test/SampleModule.class")); } @Override 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 fd7d01aff7a..59a8ffb4314 100644 --- a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java @@ -184,8 +184,8 @@ class BeanDefinitionLoader { private int load(CharSequence source) { - String resolvedSource = this.xmlReader.getEnvironment().resolvePlaceholders( - source.toString()); + String resolvedSource = this.xmlReader.getEnvironment() + .resolvePlaceholders(source.toString()); // Attempt as a Class try { @@ -248,11 +248,12 @@ class BeanDefinitionLoader { // Attempt to find a class in this package ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver( getClass().getClassLoader()); - Resource[] resources = resolver.getResources(ClassUtils - .convertClassNameToResourcePath(source.toString()) + "/*.class"); + Resource[] resources = resolver.getResources( + ClassUtils.convertClassNameToResourcePath(source.toString()) + + "/*.class"); for (Resource resource : resources) { - String className = StringUtils.stripFilenameExtension(resource - .getFilename()); + String className = StringUtils + .stripFilenameExtension(resource.getFilename()); load(Class.forName(source.toString() + "." + className)); break; } @@ -282,7 +283,8 @@ class BeanDefinitionLoader { * Simple {@link TypeFilter} used to ensure that specified {@link Class} sources are * not accidentally re-added during scanning. */ - private static class ClassExcludeFilter extends AbstractTypeHierarchyTraversingFilter { + private static class ClassExcludeFilter + extends AbstractTypeHierarchyTraversingFilter { private final Set<String> classNames = new HashSet<String>(); diff --git a/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java b/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java index cff34bfff5c..2741d7ad23e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java +++ b/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java @@ -54,10 +54,10 @@ public class ResourceBanner implements Banner { } @Override - public void printBanner(Environment environment, Class<?> sourceClass, PrintStream out) { + public void printBanner(Environment environment, Class<?> sourceClass, + PrintStream out) { try { - String banner = StreamUtils.copyToString( - this.resource.getInputStream(), + String banner = StreamUtils.copyToString(this.resource.getInputStream(), environment.getProperty("banner.charset", Charset.class, Charset.forName("UTF-8"))); @@ -84,8 +84,8 @@ public class ResourceBanner implements Banner { private PropertyResolver getVersionResolver(Class<?> sourceClass) { MutablePropertySources propertySources = new MutablePropertySources(); - propertySources.addLast(new MapPropertySource("version", - getVersionsMap(sourceClass))); + propertySources + .addLast(new MapPropertySource("version", getVersionsMap(sourceClass))); return new PropertySourcesPropertyResolver(propertySources); } @@ -96,7 +96,8 @@ public class ResourceBanner implements Banner { versions.put("application.version", getVersionString(appVersion, false)); versions.put("spring-boot.version", getVersionString(bootVersion, false)); versions.put("application.formatted-version", getVersionString(appVersion, true)); - versions.put("spring-boot.formatted-version", getVersionString(bootVersion, true)); + versions.put("spring-boot.formatted-version", + getVersionString(bootVersion, true)); return versions; } diff --git a/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java b/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java index 0cb9e57bcb0..c2165d2b3bd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java +++ b/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java @@ -139,7 +139,8 @@ class StartupInfoLogger { } }); ApplicationHome home = new ApplicationHome(this.sourceClass); - String path = (home.getSource() == null ? "" : home.getSource().getAbsolutePath()); + String path = (home.getSource() == null ? "" + : home.getSource().getAbsolutePath()); if (startedBy == null && path == null) { return ""; } 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 9b5c8e29a63..85c0de798ca 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 @@ -50,8 +50,8 @@ import org.springframework.validation.Validator; * @param <T> The target type * @author Dave Syer */ -public class PropertiesConfigurationFactory<T> implements FactoryBean<T>, - MessageSourceAware, InitializingBean { +public class PropertiesConfigurationFactory<T> + implements FactoryBean<T>, MessageSourceAware, InitializingBean { private static final char[] EXACT_DELIMITERS = { '_', '.', '[' }; @@ -248,8 +248,9 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>, } private void doBindPropertiesToTarget() throws BindException { - RelaxedDataBinder dataBinder = (this.targetName != null ? new RelaxedDataBinder( - this.target, this.targetName) : new RelaxedDataBinder(this.target)); + RelaxedDataBinder dataBinder = (this.targetName != null + ? new RelaxedDataBinder(this.target, this.targetName) + : new RelaxedDataBinder(this.target)); if (this.validator != null) { dataBinder.setValidator(this.validator); } @@ -337,9 +338,11 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>, if (errors.hasErrors()) { this.logger.error("Properties configuration failed validation"); for (ObjectError error : errors.getAllErrors()) { - this.logger.error(this.messageSource != null ? this.messageSource - .getMessage(error, Locale.getDefault()) + " (" + error + ")" - : error); + this.logger + .error(this.messageSource != null + ? this.messageSource.getMessage(error, + Locale.getDefault()) + " (" + error + ")" + : error); } if (this.exceptionIfInvalid) { throw new BindException(errors); 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 2d14b3359e9..7e59dab9889 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 @@ -122,7 +122,8 @@ public class PropertySourcesPropertyValues implements PropertyValues { } private void processEnumerablePropertySource(EnumerablePropertySource<?> source, - PropertySourcesPropertyResolver resolver, PropertyNamePatternsMatcher includes) { + PropertySourcesPropertyResolver resolver, + PropertyNamePatternsMatcher includes) { if (source.getPropertyNames().length > 0) { for (String propertyName : source.getPropertyNames()) { if (includes.matches(propertyName)) { diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java index 9c81d1ac433..2c143186cff 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java @@ -54,15 +54,15 @@ class RelaxedConversionService implements ConversionService { @Override public boolean canConvert(Class<?> sourceType, Class<?> targetType) { - return (this.conversionService != null && this.conversionService.canConvert( - sourceType, targetType)) + return (this.conversionService != null + && this.conversionService.canConvert(sourceType, targetType)) || this.additionalConverters.canConvert(sourceType, targetType); } @Override public boolean canConvert(TypeDescriptor sourceType, TypeDescriptor targetType) { - return (this.conversionService != null && this.conversionService.canConvert( - sourceType, targetType)) + return (this.conversionService != null + && this.conversionService.canConvert(sourceType, targetType)) || this.additionalConverters.canConvert(sourceType, targetType); } @@ -93,8 +93,8 @@ class RelaxedConversionService implements ConversionService { * case of the source. */ @SuppressWarnings({ "unchecked", "rawtypes" }) - private static class StringToEnumIgnoringCaseConverterFactory implements - ConverterFactory<String, Enum> { + private static class StringToEnumIgnoringCaseConverterFactory + implements ConverterFactory<String, Enum> { @Override public <T extends Enum> Converter<String, T> getConverter(Class<T> targetType) { @@ -123,8 +123,8 @@ class RelaxedConversionService implements ConversionService { } source = source.trim(); for (T candidate : (Set<T>) EnumSet.allOf(this.enumType)) { - RelaxedNames names = new RelaxedNames(candidate.name() - .replace("_", "-").toLowerCase()); + RelaxedNames names = new RelaxedNames( + candidate.name().replace("_", "-").toLowerCase()); for (String name : names) { if (name.equals(source)) { return candidate; 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 51ce53dbac6..157b7600189 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 @@ -177,12 +177,13 @@ public final class RelaxedNames implements Iterable<String> { public abstract String apply(String value); - private static String separatedToCamelCase(String value, boolean caseInsensitive) { + private static String separatedToCamelCase(String value, + boolean caseInsensitive) { StringBuilder builder = new StringBuilder(); for (String field : value.split("[_\\-.]")) { field = (caseInsensitive ? field.toLowerCase() : field); - builder.append(builder.length() == 0 ? field : StringUtils - .capitalize(field)); + builder.append( + builder.length() == 0 ? field : StringUtils.capitalize(field)); } for (String suffix : new String[] { "_", "-", "." }) { if (value.endsWith(suffix)) { diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java index fa0e6bfef05..3a85dc20a33 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java @@ -140,8 +140,8 @@ public class RelaxedPropertyResolver implements PropertyResolver { Assert.isInstanceOf(ConfigurableEnvironment.class, this.resolver, "SubProperties not available."); ConfigurableEnvironment env = (ConfigurableEnvironment) this.resolver; - return PropertySourceUtils.getSubProperties(env.getPropertySources(), - this.prefix, keyPrefix); + return PropertySourceUtils.getSubProperties(env.getPropertySources(), this.prefix, + keyPrefix); } } 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 ec32db80913..8ed91d8587b 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 @@ -48,8 +48,8 @@ import org.yaml.snakeyaml.error.YAMLException; * @author Luke Taylor * @author Dave Syer */ -public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourceAware, - InitializingBean { +public class YamlConfigurationFactory<T> + implements FactoryBean<T>, MessageSourceAware, InitializingBean { private final Log logger = LogFactory.getLog(getClass()); @@ -93,7 +93,8 @@ public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourc * @param propertyAliases the property aliases */ public void setPropertyAliases(Map<Class<?>, Map<String, String>> propertyAliases) { - this.propertyAliases = new HashMap<Class<?>, Map<String, String>>(propertyAliases); + this.propertyAliases = new HashMap<Class<?>, Map<String, String>>( + propertyAliases); } /** @@ -161,9 +162,11 @@ public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourc if (errors.hasErrors()) { this.logger.error("YAML configuration failed validation"); for (ObjectError error : errors.getAllErrors()) { - this.logger.error(this.messageSource != null ? this.messageSource - .getMessage(error, Locale.getDefault()) + " (" + error + ")" - : error); + this.logger + .error(this.messageSource != null + ? this.messageSource.getMessage(error, + Locale.getDefault()) + " (" + error + ")" + : error); } if (this.exceptionIfInvalid) { BindException summary = new BindException(errors); diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java index b94d22ea304..69eaa530b6f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java @@ -59,8 +59,8 @@ public class ParentContextApplicationContextInitializer implements } } - private static class EventPublisher implements - ApplicationListener<ContextRefreshedEvent>, Ordered { + private static class EventPublisher + implements ApplicationListener<ContextRefreshedEvent>, Ordered { private static EventPublisher INSTANCE = new EventPublisher(); diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java index 846920c4ef1..0872aee2e76 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java @@ -36,9 +36,9 @@ import org.springframework.util.ObjectUtils; * @author Dave Syer * @author Eric Bottard */ -public class ParentContextCloserApplicationListener implements - ApplicationListener<ParentContextAvailableEvent>, ApplicationContextAware, - Ordered { +public class ParentContextCloserApplicationListener + implements ApplicationListener<ParentContextAvailableEvent>, + ApplicationContextAware, Ordered { private int order = Ordered.LOWEST_PRECEDENCE - 10; @@ -83,8 +83,8 @@ public class ParentContextCloserApplicationListener implements /** * {@link ApplicationListener} to close the context. */ - protected static class ContextCloserListener implements - ApplicationListener<ContextClosedEvent> { + protected static class ContextCloserListener + implements ApplicationListener<ContextClosedEvent> { private WeakReference<ConfigurableApplicationContext> childContext; 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 325eadde721..55c4f4b5fe5 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 @@ -445,7 +445,8 @@ public class SpringApplicationBuilder { * @param beanNameGenerator the generator to set. * @return the current builder */ - public SpringApplicationBuilder beanNameGenerator(BeanNameGenerator beanNameGenerator) { + public SpringApplicationBuilder beanNameGenerator( + BeanNameGenerator beanNameGenerator) { this.application.setBeanNameGenerator(beanNameGenerator); return this; } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java index e7faadd1ce4..8e08f53c2d9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java @@ -42,16 +42,16 @@ import org.springframework.util.StringUtils; * @author Phillip Webb * @since 1.2.0 */ -public class ConfigurationWarningsApplicationContextInitializer implements - ApplicationContextInitializer<ConfigurableApplicationContext> { +public class ConfigurationWarningsApplicationContextInitializer + implements ApplicationContextInitializer<ConfigurableApplicationContext> { private static Log logger = LogFactory .getLog(ConfigurationWarningsApplicationContextInitializer.class); @Override public void initialize(ConfigurableApplicationContext context) { - context.addBeanFactoryPostProcessor(new ConfigurationWarningsPostProcessor( - getChecks())); + context.addBeanFactoryPostProcessor( + new ConfigurationWarningsPostProcessor(getChecks())); } /** @@ -65,8 +65,8 @@ public class ConfigurationWarningsApplicationContextInitializer implements /** * {@link BeanDefinitionRegistryPostProcessor} to report warnings. */ - protected final static class ConfigurationWarningsPostProcessor implements - PriorityOrdered, BeanDefinitionRegistryPostProcessor { + protected final static class ConfigurationWarningsPostProcessor + implements PriorityOrdered, BeanDefinitionRegistryPostProcessor { private Check[] checks; @@ -132,7 +132,8 @@ public class ConfigurationWarningsApplicationContextInitializer implements return null; } - private boolean isComponentScanningDefaultPackage(BeanDefinitionRegistry registry) { + private boolean isComponentScanningDefaultPackage( + BeanDefinitionRegistry registry) { String[] names = registry.getBeanDefinitionNames(); for (String name : names) { BeanDefinition definition = registry.getBeanDefinition(name); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java index 6de5da635bc..7bfcc72031f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java @@ -42,8 +42,8 @@ import org.springframework.core.Ordered; * * @author Dave Syer */ -public class FileEncodingApplicationListener implements - ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { +public class FileEncodingApplicationListener + implements ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { private static Log logger = LogFactory.getLog(FileEncodingApplicationListener.class); @@ -71,7 +71,8 @@ public class FileEncodingApplicationListener implements + desired + "'."); throw new IllegalStateException( "The Java Virtual Machine has not been configured to use the " - + "desired default character encoding (" + desired + ")."); + + "desired default character encoding (" + desired + + ")."); } } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java index 007b99397b3..5c915a8f400 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java @@ -32,8 +32,8 @@ import org.springframework.core.Ordered; * @author Raphael von der Grün * @since 1.2.0 */ -public class AnsiOutputApplicationListener implements - ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { +public class AnsiOutputApplicationListener + implements ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { @Override public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java index dc2caa5472a..8047bca8e96 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java @@ -91,16 +91,18 @@ public class DelegatingApplicationContextInitializer implements applyInitializers(context, initializers); } - private ApplicationContextInitializer<?> instantiateInitializer( - Class<?> contextClass, Class<?> initializerClass) { + private ApplicationContextInitializer<?> instantiateInitializer(Class<?> contextClass, + Class<?> initializerClass) { Class<?> requireContextClass = GenericTypeResolver.resolveTypeArgument( initializerClass, ApplicationContextInitializer.class); - Assert.isAssignable(requireContextClass, contextClass, String.format( - "Could not add context initializer [%s]" - + " as its generic parameter [%s] is not assignable " - + "from the type of application context used by this " - + "context loader [%s]: ", initializerClass.getName(), - requireContextClass.getName(), contextClass.getName())); + Assert.isAssignable(requireContextClass, contextClass, + String.format( + "Could not add context initializer [%s]" + + " as its generic parameter [%s] is not assignable " + + "from the type of application context used by this " + + "context loader [%s]: ", + initializerClass.getName(), requireContextClass.getName(), + contextClass.getName())); return (ApplicationContextInitializer<?>) BeanUtils .instantiateClass(initializerClass); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java index 531f0ba81c7..b218d840689 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java @@ -39,8 +39,8 @@ import org.springframework.util.StringUtils; * @author Dave Syer * @author Phillip Webb */ -public class DelegatingApplicationListener implements - ApplicationListener<ApplicationEvent>, Ordered { +public class DelegatingApplicationListener + implements ApplicationListener<ApplicationEvent>, Ordered { // NOTE: Similar to org.springframework.web.context.ContextLoader @@ -53,8 +53,8 @@ public class DelegatingApplicationListener implements @Override public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ApplicationEnvironmentPreparedEvent) { - List<ApplicationListener<ApplicationEvent>> delegates = getListeners(((ApplicationEnvironmentPreparedEvent) event) - .getEnvironment()); + List<ApplicationListener<ApplicationEvent>> delegates = getListeners( + ((ApplicationEnvironmentPreparedEvent) event).getEnvironment()); if (delegates.isEmpty()) { return; } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java index 8b7bb72e515..4dd8ea99628 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java @@ -38,8 +38,8 @@ import org.springframework.util.ClassUtils; * @author Ivan Sopov * @see AbstractEmbeddedServletContainerFactory */ -public abstract class AbstractConfigurableEmbeddedServletContainer implements - ConfigurableEmbeddedServletContainer { +public abstract class AbstractConfigurableEmbeddedServletContainer + implements ConfigurableEmbeddedServletContainer { private static final int DEFAULT_SESSION_TIMEOUT = (int) TimeUnit.MINUTES .toSeconds(30); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java index ae74dcda31d..83248ea00f9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java @@ -33,9 +33,9 @@ import org.apache.commons.logging.LogFactory; * @author Phillip Webb * @author Dave Syer */ -public abstract class AbstractEmbeddedServletContainerFactory extends - AbstractConfigurableEmbeddedServletContainer implements - EmbeddedServletContainerFactory { +public abstract class AbstractEmbeddedServletContainerFactory + extends AbstractConfigurableEmbeddedServletContainer + implements EmbeddedServletContainerFactory { protected final Log logger = LogFactory.getLog(getClass()); @@ -68,9 +68,9 @@ public abstract class AbstractEmbeddedServletContainerFactory extends // Or maybe there is a document root in a well-known location file = file != null ? file : getCommonDocumentRoot(); if (file == null && this.logger.isDebugEnabled()) { - this.logger.debug("None of the document roots " - + Arrays.asList(COMMON_DOC_ROOTS) - + " point to a directory and will be ignored."); + this.logger + .debug("None of the document roots " + Arrays.asList(COMMON_DOC_ROOTS) + + " point to a directory and will be ignored."); } else if (this.logger.isDebugEnabled()) { this.logger.debug("Document root: " + file); @@ -83,7 +83,8 @@ public abstract class AbstractEmbeddedServletContainerFactory extends if (this.logger.isDebugEnabled()) { this.logger.debug("Code archive: " + file); } - if (file != null && file.exists() && file.getAbsolutePath().contains("/WEB-INF/")) { + if (file != null && file.exists() + && file.getAbsolutePath().contains("/WEB-INF/")) { String path = file.getAbsolutePath(); path = path.substring(0, path.indexOf("/WEB-INF/")); return new File(path); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java index 34aa76c30af..93c1b1b5348 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java @@ -46,8 +46,8 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon * @see EmbeddedWebApplicationContext * @see AnnotationConfigWebApplicationContext */ -public class AnnotationConfigEmbeddedWebApplicationContext extends - EmbeddedWebApplicationContext { +public class AnnotationConfigEmbeddedWebApplicationContext + extends EmbeddedWebApplicationContext { private final AnnotatedBeanDefinitionReader reader; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java index 170c1dd1d5c..cd68406a375 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java @@ -34,8 +34,8 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator; * @author Dave Syer * @author Phillip Webb */ -public class EmbeddedServletContainerCustomizerBeanPostProcessor implements - BeanPostProcessor, ApplicationContextAware { +public class EmbeddedServletContainerCustomizerBeanPostProcessor + implements BeanPostProcessor, ApplicationContextAware { private ApplicationContext applicationContext; @@ -62,7 +62,8 @@ public class EmbeddedServletContainerCustomizerBeanPostProcessor implements return bean; } - private void postProcessBeforeInitialization(ConfigurableEmbeddedServletContainer bean) { + private void postProcessBeforeInitialization( + ConfigurableEmbeddedServletContainer bean) { for (EmbeddedServletContainerCustomizer customizer : getCustomizers()) { customizer.customize(bean); } @@ -72,8 +73,9 @@ public class EmbeddedServletContainerCustomizerBeanPostProcessor implements if (this.customizers == null) { // Look up does not include the parent context this.customizers = new ArrayList<EmbeddedServletContainerCustomizer>( - this.applicationContext.getBeansOfType( - EmbeddedServletContainerCustomizer.class, false, false) + this.applicationContext + .getBeansOfType(EmbeddedServletContainerCustomizer.class, + false, false) .values()); Collections.sort(this.customizers, AnnotationAwareOrderComparator.INSTANCE); this.customizers = Collections.unmodifiableList(this.customizers); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java index 187a2282a40..86c6f7d5e43 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java @@ -106,9 +106,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext */ @Override protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { - beanFactory - .addBeanPostProcessor(new WebApplicationContextServletContextAwareProcessor( - this)); + beanFactory.addBeanPostProcessor( + new WebApplicationContextServletContextAwareProcessor(this)); beanFactory.ignoreDependencyInterface(ServletContextAware.class); } @@ -162,8 +161,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext getSelfInitializer().onStartup(getServletContext()); } catch (ServletException ex) { - throw new ApplicationContextException( - "Cannot initialize servlet context", ex); + throw new ApplicationContextException("Cannot initialize servlet context", + ex); } } initPropertySources(); @@ -177,8 +176,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext */ protected EmbeddedServletContainerFactory getEmbeddedServletContainerFactory() { // Use bean names so that we don't consider the hierarchy - String[] beanNames = getBeanFactory().getBeanNamesForType( - EmbeddedServletContainerFactory.class); + String[] beanNames = getBeanFactory() + .getBeanNamesForType(EmbeddedServletContainerFactory.class); if (beanNames.length == 0) { throw new ApplicationContextException( "Unable to start EmbeddedWebApplicationContext due to missing " @@ -243,8 +242,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext * @param servletContext the operational servlet context */ protected void prepareEmbeddedWebApplicationContext(ServletContext servletContext) { - Object rootContext = servletContext - .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); + Object rootContext = servletContext.getAttribute( + WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (rootContext != null) { if (rootContext == this) { throw new IllegalStateException( @@ -259,9 +258,10 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext servletContext.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this); if (logger.isDebugEnabled()) { - logger.debug("Published root WebApplicationContext as ServletContext attribute with name [" - + WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE - + "]"); + logger.debug( + "Published root WebApplicationContext as ServletContext attribute with name [" + + WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE + + "]"); } setServletContext(servletContext); if (logger.isInfoEnabled()) { @@ -347,6 +347,7 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext public static class ExistingWebApplicationScopes { private static final Set<String> SCOPES; + static { Set<String> scopes = new LinkedHashSet<String>(); scopes.add(WebApplicationContext.SCOPE_REQUEST); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/FilterRegistrationBean.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/FilterRegistrationBean.java index 5d1722c659b..b27aff4fd5a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/FilterRegistrationBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/FilterRegistrationBean.java @@ -40,10 +40,10 @@ import org.springframework.util.Assert; * <p> * The {@link #setFilter(Filter) Filter} must be specified before calling * {@link #onStartup(ServletContext)}. Registrations can be associated with - * {@link #setUrlPatterns URL patterns} and/or servlets (either by - * {@link #setServletNames name} or via a {@link #setServletRegistrationBeans - * ServletRegistrationBean}s. When no URL pattern or servlets are specified the filter - * will be associated to '/*'. The filter name will be deduced if not specified. + * {@link #setUrlPatterns URL patterns} and/or servlets (either by {@link #setServletNames + * name} or via a {@link #setServletRegistrationBeans ServletRegistrationBean}s. When no + * URL pattern or servlets are specified the filter will be associated to '/*'. The filter + * name will be deduced if not specified. * * @author Phillip Webb * @see ServletContextInitializer @@ -62,8 +62,8 @@ public class FilterRegistrationBean extends RegistrationBean { DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.REQUEST, DispatcherType.ASYNC); - static final EnumSet<DispatcherType> NON_ASYNC_DISPATCHER_TYPES = EnumSet.of( - DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.REQUEST); + static final EnumSet<DispatcherType> NON_ASYNC_DISPATCHER_TYPES = EnumSet + .of(DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.REQUEST); private static final String[] DEFAULT_URL_MAPPINGS = { "/*" }; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/InitParameterConfiguringServletContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/InitParameterConfiguringServletContextInitializer.java index 617384209a9..6a0ce625b6f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/InitParameterConfiguringServletContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/InitParameterConfiguringServletContextInitializer.java @@ -30,8 +30,8 @@ import javax.servlet.ServletException; * @since 1.2.0 * @see ServletContext#setInitParameter(String, String) */ -public class InitParameterConfiguringServletContextInitializer implements - ServletContextInitializer { +public class InitParameterConfiguringServletContextInitializer + implements ServletContextInitializer { private final Map<String, String> parameters; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java index 93da4b59498..bd307486159 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java @@ -37,6 +37,7 @@ public final class MimeMappings implements Iterable<Mapping> { * Default mime mapping commonly used. */ public static final MimeMappings DEFAULT; + static { MimeMappings mappings = new MimeMappings(); mappings.add("abs", "audio/x-mpeg"); @@ -248,8 +249,9 @@ public final class MimeMappings implements Iterable<Mapping> { */ private MimeMappings(MimeMappings mappings, boolean mutable) { Assert.notNull(mappings, "Mappings must not be null"); - this.map = (mutable ? new LinkedHashMap<String, MimeMappings.Mapping>( - mappings.map) : Collections.unmodifiableMap(mappings.map)); + this.map = (mutable + ? new LinkedHashMap<String, MimeMappings.Mapping>(mappings.map) + : Collections.unmodifiableMap(mappings.map)); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletContextInitializerBeans.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletContextInitializerBeans.java index a64ed591ec8..d545ed79510 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletContextInitializerBeans.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletContextInitializerBeans.java @@ -55,8 +55,8 @@ import org.springframework.util.MultiValueMap; * @author Dave Syer * @author Phillip Webb */ -class ServletContextInitializerBeans extends - AbstractCollection<ServletContextInitializer> { +class ServletContextInitializerBeans + extends AbstractCollection<ServletContextInitializer> { static final String DISPATCHER_SERVLET_NAME = "dispatcherServlet"; @@ -127,7 +127,8 @@ class ServletContextInitializerBeans extends } } - private String getResourceDescription(String beanName, ListableBeanFactory beanFactory) { + private String getResourceDescription(String beanName, + ListableBeanFactory beanFactory) { if (beanFactory instanceof BeanDefinitionRegistry) { BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; return registry.getBeanDefinition(beanName).getResourceDescription(); @@ -142,7 +143,8 @@ class ServletContextInitializerBeans extends new ServletRegistrationBeanAdapter(multipartConfig)); addAsRegistrationBean(beanFactory, Filter.class, new FilterRegistrationBeanAdapter()); - for (Class<?> listenerType : ServletListenerRegistrationBean.getSupportedTypes()) { + for (Class<?> listenerType : ServletListenerRegistrationBean + .getSupportedTypes()) { addAsRegistrationBean(beanFactory, EventListener.class, (Class<EventListener>) listenerType, new ServletListenerRegistrationBeanAdapter()); @@ -155,8 +157,8 @@ class ServletContextInitializerBeans extends return (beans.isEmpty() ? null : beans.get(0).getValue()); } - private <T> void addAsRegistrationBean(ListableBeanFactory beanFactory, - Class<T> type, RegistrationBeanAdapter<T> adapter) { + private <T> void addAsRegistrationBean(ListableBeanFactory beanFactory, Class<T> type, + RegistrationBeanAdapter<T> adapter) { addAsRegistrationBean(beanFactory, type, type, adapter); } @@ -175,10 +177,10 @@ class ServletContextInitializerBeans extends this.initializers.add(type, registration); if (this.log.isDebugEnabled()) { - this.log.debug("Created " + type.getSimpleName() - + " initializer for bean '" + beanName + "'; order=" + order - + ", resource=" - + getResourceDescription(beanName, beanFactory)); + this.log.debug( + "Created " + type.getSimpleName() + " initializer for bean '" + + beanName + "'; order=" + order + ", resource=" + + getResourceDescription(beanName, beanFactory)); } } } @@ -237,8 +239,8 @@ class ServletContextInitializerBeans extends /** * {@link RegistrationBeanAdapter} for {@link Servlet} beans. */ - private static class ServletRegistrationBeanAdapter implements - RegistrationBeanAdapter<Servlet> { + private static class ServletRegistrationBeanAdapter + implements RegistrationBeanAdapter<Servlet> { private final MultipartConfigElement multipartConfig; @@ -263,8 +265,8 @@ class ServletContextInitializerBeans extends /** * {@link RegistrationBeanAdapter} for {@link Filter} beans. */ - private static class FilterRegistrationBeanAdapter implements - RegistrationBeanAdapter<Filter> { + private static class FilterRegistrationBeanAdapter + implements RegistrationBeanAdapter<Filter> { @Override public RegistrationBean createRegistrationBean(String name, Filter source, @@ -277,8 +279,8 @@ class ServletContextInitializerBeans extends /** * {@link RegistrationBeanAdapter} for certain {@link EventListener} beans. */ - private static class ServletListenerRegistrationBeanAdapter implements - RegistrationBeanAdapter<EventListener> { + private static class ServletListenerRegistrationBeanAdapter + implements RegistrationBeanAdapter<EventListener> { @Override public RegistrationBean createRegistrationBean(String name, EventListener source, diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java index b60a2e9fc17..6f9a668a028 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java @@ -55,12 +55,13 @@ import org.springframework.util.ClassUtils; * @author Dave Syer * @author Phillip Webb */ -public class ServletListenerRegistrationBean<T extends EventListener> extends - RegistrationBean { +public class ServletListenerRegistrationBean<T extends EventListener> + extends RegistrationBean { private static Log logger = LogFactory.getLog(ServletListenerRegistrationBean.class); private static final Set<Class<?>> SUPPORTED_TYPES; + static { Set<Class<?>> types = new HashSet<Class<?>>(); types.add(ServletContextAttributeListener.class); @@ -110,8 +111,9 @@ public class ServletListenerRegistrationBean<T extends EventListener> extends servletContext.addListener(this.listener); } catch (RuntimeException ex) { - throw new IllegalStateException("Failed to add listener '" + this.listener - + "' to servlet context", ex); + throw new IllegalStateException( + "Failed to add listener '" + this.listener + "' to servlet context", + ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/WebApplicationContextServletContextAwareProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/WebApplicationContextServletContextAwareProcessor.java index c89ef360629..c59b651e621 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/WebApplicationContextServletContextAwareProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/WebApplicationContextServletContextAwareProcessor.java @@ -31,8 +31,8 @@ import org.springframework.web.context.support.ServletContextAwareProcessor; * * @author Phillip Webb */ -public class WebApplicationContextServletContextAwareProcessor extends - ServletContextAwareProcessor { +public class WebApplicationContextServletContextAwareProcessor + extends ServletContextAwareProcessor { private final ConfigurableWebApplicationContext webApplicationContext; 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 662c70a5a37..fc98e25b08c 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 @@ -115,8 +115,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { for (Connector connector : connectors) { connector.start(); } - JettyEmbeddedServletContainer.logger.info("Jetty started on port(s) " - + getActualPortsDescription()); + JettyEmbeddedServletContainer.logger + .info("Jetty started on port(s) " + getActualPortsDescription()); } catch (Exception ex) { throw new EmbeddedServletContainerException( @@ -141,8 +141,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { connector); } catch (Exception ex) { - JettyEmbeddedServletContainer.logger.info("could not determine port ( " - + ex.getMessage() + ")"); + JettyEmbeddedServletContainer.logger + .info("could not determine port ( " + ex.getMessage() + ")"); return 0; } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java index 9d27e706a34..03659a74515 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java @@ -65,9 +65,9 @@ class SkipPatternJarScanner extends StandardJarScanner { // For Tomcat 7 compatibility public void scan(ServletContext context, ClassLoader classloader, JarScannerCallback callback, Set<String> jarsToSkip) { - Method scanMethod = ReflectionUtils.findMethod(this.jarScanner.getClass(), - "scan", ServletContext.class, ClassLoader.class, - JarScannerCallback.class, Set.class); + Method scanMethod = ReflectionUtils.findMethod(this.jarScanner.getClass(), "scan", + ServletContext.class, ClassLoader.class, JarScannerCallback.class, + Set.class); Assert.notNull(scanMethod, "Unable to find scan method"); try { scanMethod.invoke(this.jarScanner, context, classloader, callback, @@ -84,8 +84,8 @@ class SkipPatternJarScanner extends StandardJarScanner { * @param pattern the jar skip pattern or {@code null} for defaults */ public static void apply(TomcatEmbeddedContext context, String pattern) { - SkipPatternJarScanner scanner = new SkipPatternJarScanner( - context.getJarScanner(), pattern); + SkipPatternJarScanner scanner = new SkipPatternJarScanner(context.getJarScanner(), + pattern); context.setJarScanner(scanner); } 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 3c4ab095b67..987d67067ac 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 @@ -76,8 +76,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer } private synchronized void initialize() throws EmbeddedServletContainerException { - TomcatEmbeddedServletContainer.logger.info("Tomcat initialized with port(s): " - + getPortsDescription(false)); + TomcatEmbeddedServletContainer.logger + .info("Tomcat initialized with port(s): " + getPortsDescription(false)); try { addInstanceIdToEngineName(); @@ -95,8 +95,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer startDaemonAwaitThread(); } catch (Exception ex) { - throw new EmbeddedServletContainerException( - "Unable to start embedded Tomcat", ex); + throw new EmbeddedServletContainerException("Unable to start embedded Tomcat", + ex); } } @@ -156,8 +156,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer stopSilently(); throw new IllegalStateException("Tomcat connector in failed state"); } - TomcatEmbeddedServletContainer.logger.info("Tomcat started on port(s): " - + getPortsDescription(true)); + TomcatEmbeddedServletContainer.logger + .info("Tomcat started on port(s): " + getPortsDescription(true)); } private boolean connectorsHaveFailedToStart() { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java index 20ae60b6300..f96337d63ad 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java @@ -116,8 +116,8 @@ public class TomcatEmbeddedWebappClassLoader extends WebappClassLoader { private void checkPackageAccess(String name) throws ClassNotFoundException { if (this.securityManager != null && name.lastIndexOf('.') >= 0) { try { - this.securityManager.checkPackageAccess(name.substring(0, - name.lastIndexOf('.'))); + this.securityManager + .checkPackageAccess(name.substring(0, name.lastIndexOf('.'))); } catch (SecurityException ex) { throw new ClassNotFoundException("Security Violation, attempt to use " diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java index 35b33515608..83962366377 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java @@ -142,8 +142,8 @@ abstract class TomcatResources { try { Class<?> fileDirContextClass = Class .forName("org.apache.naming.resources.FileDirContext"); - Method setDocBaseMethod = ReflectionUtils.findMethod( - fileDirContextClass, "setDocBase", String.class); + Method setDocBaseMethod = ReflectionUtils + .findMethod(fileDirContextClass, "setDocBase", String.class); Object fileDirContext = fileDirContextClass.newInstance(); setDocBaseMethod.invoke(fileDirContext, dir); Method addResourcesDirContextMethod = ReflectionUtils.findMethod( diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java index f6c0471aae7..c051470d8c5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java @@ -107,8 +107,8 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine } this.undertow.start(); this.started = true; - UndertowEmbeddedServletContainer.logger.info("Undertow started on port(s) " - + getPortsDescription()); + UndertowEmbeddedServletContainer.logger + .info("Undertow started on port(s) " + getPortsDescription()); } private Undertow createUndertowServer() { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java index 899a40d3e39..d58c9df95ee 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java @@ -94,8 +94,8 @@ import io.undertow.servlet.util.ImmediateInstanceFactory; * @since 1.2.0 * @see UndertowEmbeddedServletContainer */ -public class UndertowEmbeddedServletContainerFactory extends - AbstractEmbeddedServletContainerFactory implements ResourceLoaderAware { +public class UndertowEmbeddedServletContainerFactory + extends AbstractEmbeddedServletContainerFactory implements ResourceLoaderAware { private static final Set<Class<?>> NO_CLASSES = Collections.emptySet(); @@ -301,8 +301,9 @@ public class UndertowEmbeddedServletContainerFactory extends // Get key manager to provide client credentials. KeyManagerFactory keyManagerFactory = KeyManagerFactory .getInstance(KeyManagerFactory.getDefaultAlgorithm()); - char[] keyPassword = ssl.getKeyPassword() != null ? ssl.getKeyPassword() - .toCharArray() : ssl.getKeyStorePassword().toCharArray(); + char[] keyPassword = ssl.getKeyPassword() != null + ? ssl.getKeyPassword().toCharArray() + : ssl.getKeyStorePassword().toCharArray(); keyManagerFactory.init(keyStore, keyPassword); return keyManagerFactory.getKeyManagers(); } @@ -324,8 +325,8 @@ public class UndertowEmbeddedServletContainerFactory extends } KeyStore trustedKeyStore = KeyStore.getInstance(trustStoreType); URL url = ResourceUtils.getURL(trustStore); - trustedKeyStore.load(url.openStream(), ssl.getTrustStorePassword() - .toCharArray()); + trustedKeyStore.load(url.openStream(), + ssl.getTrustStorePassword().toCharArray()); TrustManagerFactory trustManagerFactory = TrustManagerFactory .getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(trustedKeyStore); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java index e66100f496f..67aa3b0e5a8 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java @@ -68,7 +68,8 @@ public class ConfigurationBeanFactoryMetaData implements BeanFactoryPostProcesso return result; } - public <A extends Annotation> A findFactoryAnnotation(String beanName, Class<A> type) { + public <A extends Annotation> A findFactoryAnnotation(String beanName, + Class<A> type) { Method method = findFactoryMethod(beanName); return (method == null ? null : AnnotationUtils.findAnnotation(method, type)); } @@ -83,8 +84,8 @@ public class ConfigurationBeanFactoryMetaData implements BeanFactoryPostProcesso Class<?> type = this.beanFactory.getType(meta.getBean()); ReflectionUtils.doWithMethods(type, new MethodCallback() { @Override - public void doWith(Method method) throws IllegalArgumentException, - IllegalAccessException { + public void doWith(Method method) + throws IllegalArgumentException, IllegalAccessException { if (method.getName().equals(factory)) { found.compareAndSet(null, method); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java index 1742d9404f8..459972fddee 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java @@ -28,8 +28,8 @@ import org.springframework.core.type.AnnotationMetadata; * @author Dave Syer * @author Phillip Webb */ -public class ConfigurationPropertiesBindingPostProcessorRegistrar implements - ImportBeanDefinitionRegistrar { +public class ConfigurationPropertiesBindingPostProcessorRegistrar + implements ImportBeanDefinitionRegistrar { /** * The bean name of the {@link ConfigurationPropertiesBindingPostProcessor}. @@ -45,8 +45,8 @@ public class ConfigurationPropertiesBindingPostProcessorRegistrar implements if (!registry.containsBeanDefinition(BINDER_BEAN_NAME)) { BeanDefinitionBuilder meta = BeanDefinitionBuilder .genericBeanDefinition(ConfigurationBeanFactoryMetaData.class); - BeanDefinitionBuilder bean = BeanDefinitionBuilder - .genericBeanDefinition(ConfigurationPropertiesBindingPostProcessor.class); + BeanDefinitionBuilder bean = BeanDefinitionBuilder.genericBeanDefinition( + ConfigurationPropertiesBindingPostProcessor.class); bean.addPropertyReference("beanMetaDataStore", METADATA_BEAN_NAME); registry.registerBeanDefinition(BINDER_BEAN_NAME, bean.getBeanDefinition()); registry.registerBeanDefinition(METADATA_BEAN_NAME, meta.getBeanDefinition()); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java b/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java index 14f5f055952..d90586dde9f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java @@ -89,8 +89,8 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine @Override protected void doFilterInternal(HttpServletRequest request, - HttpServletResponse response, FilterChain chain) throws ServletException, - IOException { + HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { ErrorPageFilter.this.doFilter(request, response, chain); } @@ -138,7 +138,7 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine private void handleErrorStatus(HttpServletRequest request, HttpServletResponse response, int status, String message) - throws ServletException, IOException { + throws ServletException, IOException { if (response.isCommitted()) { handleCommittedResponse(request, null); return; @@ -153,9 +153,9 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine request.getRequestDispatcher(errorPath).forward(request, response); } - private void handleException(HttpServletRequest request, - HttpServletResponse response, ErrorWrapperResponse wrapped, Throwable ex) - throws IOException, ServletException { + private void handleException(HttpServletRequest request, HttpServletResponse response, + ErrorWrapperResponse wrapped, Throwable ex) + throws IOException, ServletException { Class<?> type = ex.getClass(); String errorPath = getErrorPath(type); if (errorPath == null) { @@ -171,8 +171,8 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine } private void forwardToErrorPage(String path, HttpServletRequest request, - HttpServletResponse response, Throwable ex) throws ServletException, - IOException { + HttpServletResponse response, Throwable ex) + throws ServletException, IOException { if (logger.isErrorEnabled()) { String message = "Forwarding to error page from request " + getDescription(request) + " due to exception [" + ex.getMessage() @@ -234,7 +234,8 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine return this.global; } - private void setErrorAttributes(HttpServletRequest request, int status, String message) { + private void setErrorAttributes(HttpServletRequest request, int status, + String message) { request.setAttribute(ERROR_STATUS_CODE, status); request.setAttribute(ERROR_MESSAGE, message); request.setAttribute(ERROR_REQUEST_URI, request.getRequestURI()); @@ -313,8 +314,8 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine @Override public void flushBuffer() throws IOException { if (this.hasErrorToSend && !isCommitted()) { - ((HttpServletResponse) getResponse()) - .sendError(this.status, this.message); + ((HttpServletResponse) getResponse()).sendError(this.status, + this.message); } super.flushBuffer(); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedCharacterEncodingFilter.java b/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedCharacterEncodingFilter.java index a3281343023..a220e8846ec 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedCharacterEncodingFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedCharacterEncodingFilter.java @@ -25,8 +25,8 @@ import org.springframework.web.filter.CharacterEncodingFilter; * @author Phillip Webb * @since 1.2.1 */ -public class OrderedCharacterEncodingFilter extends CharacterEncodingFilter implements - Ordered { +public class OrderedCharacterEncodingFilter extends CharacterEncodingFilter + implements Ordered { private int order = Ordered.HIGHEST_PRECEDENCE; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHiddenHttpMethodFilter.java b/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHiddenHttpMethodFilter.java index c6f1f111b81..4b573879aff 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHiddenHttpMethodFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHiddenHttpMethodFilter.java @@ -26,8 +26,8 @@ import org.springframework.web.filter.HiddenHttpMethodFilter; * @author Phillip Webb * @since 1.2.4 */ -public class OrderedHiddenHttpMethodFilter extends HiddenHttpMethodFilter implements - Ordered { +public class OrderedHiddenHttpMethodFilter extends HiddenHttpMethodFilter + implements Ordered { /** * The default order is high to ensure the filter is applied before Spring Security. diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java index 401a47c0551..0ed4a54061c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java @@ -78,7 +78,8 @@ public abstract class SpringBootServletInitializer implements WebApplicationInit @Override public void onStartup(ServletContext servletContext) throws ServletException { - WebApplicationContext rootAppContext = createRootApplicationContext(servletContext); + WebApplicationContext rootAppContext = createRootApplicationContext( + servletContext); if (rootAppContext != null) { servletContext.addListener(new ContextLoaderListener(rootAppContext) { @Override @@ -105,13 +106,13 @@ public abstract class SpringBootServletInitializer implements WebApplicationInit WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, null); builder.initializers(new ParentContextApplicationContextInitializer(parent)); } - builder.initializers(new ServletContextApplicationContextInitializer( - servletContext)); + builder.initializers( + new ServletContextApplicationContextInitializer(servletContext)); builder.contextClass(AnnotationConfigEmbeddedWebApplicationContext.class); builder = configure(builder); SpringApplication application = builder.build(); - if (application.getSources().isEmpty() - && AnnotationUtils.findAnnotation(getClass(), Configuration.class) != null) { + if (application.getSources().isEmpty() && AnnotationUtils + .findAnnotation(getClass(), Configuration.class) != null) { application.getSources().add(getClass()); } Assert.state(application.getSources().size() > 0, @@ -146,8 +147,8 @@ public abstract class SpringBootServletInitializer implements WebApplicationInit private ApplicationContext getExistingRootWebApplicationContext( ServletContext servletContext) { - Object context = servletContext - .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); + Object context = servletContext.getAttribute( + WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (context instanceof ApplicationContext) { return (ApplicationContext) context; } diff --git a/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java b/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java index 094382591bb..4db0d2b8412 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java @@ -33,8 +33,8 @@ import org.springframework.core.env.PropertySource; * @see PropertySource * @see EnumerablePropertySource */ -public class EnumerableCompositePropertySource extends - EnumerablePropertySource<Collection<PropertySource<?>>> { +public class EnumerableCompositePropertySource + extends EnumerablePropertySource<Collection<PropertySource<?>>> { private volatile String[] names; @@ -58,10 +58,11 @@ public class EnumerableCompositePropertySource extends String[] result = this.names; if (result == null) { List<String> names = new ArrayList<String>(); - for (PropertySource<?> source : new ArrayList<PropertySource<?>>(getSource())) { + for (PropertySource<?> source : new ArrayList<PropertySource<?>>( + getSource())) { if (source instanceof EnumerablePropertySource) { - names.addAll(Arrays.asList(((EnumerablePropertySource<?>) source) - .getPropertyNames())); + names.addAll(Arrays.asList( + ((EnumerablePropertySource<?>) source).getPropertyNames())); } } this.names = names.toArray(new String[0]); diff --git a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java index 5cc5d66bee5..6896ead19db 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java @@ -134,10 +134,8 @@ public class PropertySourcesLoader { } private boolean isFile(Resource resource) { - return resource != null - && resource.exists() - && StringUtils.hasText(StringUtils.getFilenameExtension(resource - .getFilename())); + return resource != null && resource.exists() && StringUtils + .hasText(StringUtils.getFilenameExtension(resource.getFilename())); } private String generatePropertySourceName(String name, String profile) { diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBean.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBean.java index fb2115cb2d1..293e3ec0d19 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBean.java @@ -31,9 +31,9 @@ import org.springframework.util.StringUtils; */ @SuppressWarnings("serial") @ConfigurationProperties(prefix = "spring.jta.atomikos.connectionfactory") -public class AtomikosConnectionFactoryBean extends - com.atomikos.jms.AtomikosConnectionFactoryBean implements BeanNameAware, - InitializingBean, DisposableBean { +public class AtomikosConnectionFactoryBean + extends com.atomikos.jms.AtomikosConnectionFactoryBean + implements BeanNameAware, InitializingBean, DisposableBean { private String beanName; diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java index f96c3309cc2..a7ebd0f3f45 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java @@ -32,15 +32,15 @@ import com.atomikos.icatch.jta.UserTransactionManager; /** * {@link BeanFactoryPostProcessor} to automatically setup the recommended - * {@link BeanDefinition#setDependsOn(String[]) dependsOn} settings for <a - * href="http://www.atomikos.com/Documentation/SpringIntegration">correct Atomikos + * {@link BeanDefinition#setDependsOn(String[]) dependsOn} settings for + * <a href="http://www.atomikos.com/Documentation/SpringIntegration">correct Atomikos * ordering</a>. * * @author Phillip Webb * @since 1.2.0 */ -public class AtomikosDependsOnBeanFactoryPostProcessor implements - BeanFactoryPostProcessor, Ordered { +public class AtomikosDependsOnBeanFactoryPostProcessor + implements BeanFactoryPostProcessor, Ordered { private static final String[] NO_BEANS = {}; @@ -49,8 +49,8 @@ public class AtomikosDependsOnBeanFactoryPostProcessor implements @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - String[] transactionManagers = beanFactory.getBeanNamesForType( - UserTransactionManager.class, true, false); + String[] transactionManagers = beanFactory + .getBeanNamesForType(UserTransactionManager.class, true, false); for (String transactionManager : transactionManagers) { addTransactionManagerDependencies(beanFactory, transactionManager); } @@ -75,14 +75,15 @@ public class AtomikosDependsOnBeanFactoryPostProcessor implements "com.atomikos.jms.extra.MessageDrivenContainer"); for (String messageDrivenContainer : messageDrivenContainers) { BeanDefinition bean = beanFactory.getBeanDefinition(messageDrivenContainer); - Set<String> dependsOn = new LinkedHashSet<String>(asList(bean.getDependsOn())); + Set<String> dependsOn = new LinkedHashSet<String>( + asList(bean.getDependsOn())); dependsOn.addAll(asList(transactionManagers)); bean.setDependsOn(dependsOn.toArray(new String[dependsOn.size()])); } } - private void addDependencies(ConfigurableListableBeanFactory beanFactory, - String type, Set<String> dependsOn) { + private void addDependencies(ConfigurableListableBeanFactory beanFactory, String type, + Set<String> dependsOn) { dependsOn.addAll(asList(getBeanNamesForType(beanFactory, type))); } diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java index b742c25e12d..18b14de2dfd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java @@ -21,8 +21,8 @@ import java.util.Properties; import java.util.TreeMap; /** - * Bean friendly variant of <a - * href="http://www.atomikos.com/Documentation/JtaProperties">Atomikos configuration + * Bean friendly variant of + * <a href="http://www.atomikos.com/Documentation/JtaProperties">Atomikos configuration * properties</a>. Allows for setter based configuration and is amiable to relaxed data * binding. * diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosXAConnectionFactoryWrapper.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosXAConnectionFactoryWrapper.java index c370bb945bd..af5cae55c24 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosXAConnectionFactoryWrapper.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosXAConnectionFactoryWrapper.java @@ -31,7 +31,8 @@ import org.springframework.boot.jta.XAConnectionFactoryWrapper; public class AtomikosXAConnectionFactoryWrapper implements XAConnectionFactoryWrapper { @Override - public ConnectionFactory wrapConnectionFactory(XAConnectionFactory connectionFactory) { + public ConnectionFactory wrapConnectionFactory( + XAConnectionFactory connectionFactory) { AtomikosConnectionFactoryBean bean = new AtomikosConnectionFactoryBean(); bean.setXaConnectionFactory(connectionFactory); return bean; diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java index 2ce3b8a2293..d2b097e3246 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java @@ -33,8 +33,8 @@ import org.springframework.core.Ordered; * @author Phillip Webb * @since 1.2.0 */ -public class BitronixDependentBeanFactoryPostProcessor implements - BeanFactoryPostProcessor, Ordered { +public class BitronixDependentBeanFactoryPostProcessor + implements BeanFactoryPostProcessor, Ordered { private static final String[] NO_BEANS = {}; @@ -43,8 +43,8 @@ public class BitronixDependentBeanFactoryPostProcessor implements @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - String[] transactionManagers = beanFactory.getBeanNamesForType( - TransactionManager.class, true, false); + String[] transactionManagers = beanFactory + .getBeanNamesForType(TransactionManager.class, true, false); for (String transactionManager : transactionManagers) { addTransactionManagerDependencies(beanFactory, transactionManager); } diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java index 6a539c9a0ca..1811de0857e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java @@ -31,7 +31,8 @@ import org.springframework.boot.jta.XAConnectionFactoryWrapper; public class BitronixXAConnectionFactoryWrapper implements XAConnectionFactoryWrapper { @Override - public ConnectionFactory wrapConnectionFactory(XAConnectionFactory connectionFactory) { + public ConnectionFactory wrapConnectionFactory( + XAConnectionFactory connectionFactory) { PoolingConnectionFactoryBean pool = new PoolingConnectionFactoryBean(); pool.setConnectionFactory(connectionFactory); return pool; diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java index 2edd1a07bff..507ed77509f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java @@ -30,7 +30,8 @@ import org.springframework.boot.jta.XADataSourceWrapper; public class BitronixXADataSourceWrapper implements XADataSourceWrapper { @Override - public PoolingDataSourceBean wrapDataSource(XADataSource dataSource) throws Exception { + public PoolingDataSourceBean wrapDataSource(XADataSource dataSource) + throws Exception { PoolingDataSourceBean pool = new PoolingDataSourceBean(); pool.setDataSource(dataSource); return pool; diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java index 50f7a853f23..d377cb2f16d 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java @@ -43,8 +43,8 @@ import bitronix.tm.resource.jms.PoolingConnectionFactory; */ @SuppressWarnings("serial") @ConfigurationProperties(prefix = "spring.jta.bitronix.connectionfactory") -public class PoolingConnectionFactoryBean extends PoolingConnectionFactory implements - BeanNameAware, InitializingBean, DisposableBean { +public class PoolingConnectionFactoryBean extends PoolingConnectionFactory + implements BeanNameAware, InitializingBean, DisposableBean { private static ThreadLocal<PoolingConnectionFactoryBean> source = new ThreadLocal<PoolingConnectionFactoryBean>(); diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java index adba55d5a38..7a796eb9a44 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java @@ -47,8 +47,8 @@ import bitronix.tm.resource.jdbc.PoolingDataSource; */ @SuppressWarnings("serial") @ConfigurationProperties(prefix = "spring.jta.bitronix.datasource") -public class PoolingDataSourceBean extends PoolingDataSource implements BeanNameAware, - InitializingBean { +public class PoolingDataSourceBean extends PoolingDataSource + implements BeanNameAware, InitializingBean { private static ThreadLocal<PoolingDataSourceBean> source = new ThreadLocal<PoolingDataSourceBean>(); diff --git a/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java index 9fc73e95402..276cbc29ce0 100644 --- a/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java @@ -32,8 +32,8 @@ import liquibase.servicelocator.ServiceLocator; * @author Phillip Webb * @author Dave Syer */ -public class LiquibaseServiceLocatorApplicationListener implements - ApplicationListener<ApplicationStartedEvent> { +public class LiquibaseServiceLocatorApplicationListener + implements ApplicationListener<ApplicationStartedEvent> { static final Log logger = LogFactory .getLog(LiquibaseServiceLocatorApplicationListener.class); diff --git a/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java b/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java index f66a5f2c59b..27b358863c4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java +++ b/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java @@ -64,7 +64,8 @@ public class SpringPackageScanClassResolver extends DefaultPackageScanClassResol } private Resource[] scan(ClassLoader loader, String packageName) throws IOException { - ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(loader); + ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver( + loader); String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + ClassUtils.convertClassNameToResourcePath(packageName) + "/**/*.class"; Resource[] resources = resolver.getResources(pattern); @@ -87,8 +88,8 @@ public class SpringPackageScanClassResolver extends DefaultPackageScanClassResol } catch (Throwable ex) { if (this.logger.isWarnEnabled()) { - this.logger.warn("Unexpected failure when loading class resource " - + resource, ex); + this.logger.warn( + "Unexpected failure when loading class resource " + resource, ex); } return null; } @@ -96,8 +97,8 @@ public class SpringPackageScanClassResolver extends DefaultPackageScanClassResol private void handleFailure(Resource resource, Throwable ex) { if (this.logger.isDebugEnabled()) { - this.logger.debug("Ignoring candidate class resource " + resource - + " due to " + ex); + this.logger.debug( + "Ignoring candidate class resource " + resource + " due to " + ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java index 2f7f3a2d218..58ff58c489e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java @@ -54,7 +54,8 @@ import org.springframework.util.StringUtils; * <ul> * <li>{@code LOG_FILE} is set to the value of path of the log file that should be written * (if any).</li> - * <li>{@code PID} is set to the value of the current process ID if it can be determined.</li> + * <li>{@code PID} is set to the value of the current process ID if it can be determined. + * </li> * </ul> * * @author Dave Syer @@ -98,6 +99,7 @@ public class LoggingApplicationListener implements GenericApplicationListener { public static final String EXCEPTION_CONVERSION_WORD = "LOG_EXCEPTION_CONVERSION_WORD"; private static MultiValueMap<LogLevel, String> LOG_LEVEL_LOGGERS; + static { LOG_LEVEL_LOGGERS = new LinkedMultiValueMap<LogLevel, String>(); LOG_LEVEL_LOGGERS.add(LogLevel.DEBUG, "org.springframework.boot"); @@ -152,7 +154,8 @@ public class LoggingApplicationListener implements GenericApplicationListener { onApplicationStartedEvent((ApplicationStartedEvent) event); } else if (event instanceof ApplicationEnvironmentPreparedEvent) { - onApplicationEnvironmentPreparedEvent((ApplicationEnvironmentPreparedEvent) event); + onApplicationEnvironmentPreparedEvent( + (ApplicationEnvironmentPreparedEvent) event); } else if (event instanceof ContextClosedEvent) { onContextClosedEvent(); @@ -160,16 +163,16 @@ public class LoggingApplicationListener implements GenericApplicationListener { } private void onApplicationStartedEvent(ApplicationStartedEvent event) { - this.loggingSystem = LoggingSystem.get(event.getSpringApplication() - .getClassLoader()); + this.loggingSystem = LoggingSystem + .get(event.getSpringApplication().getClassLoader()); this.loggingSystem.beforeInitialize(); } private void onApplicationEnvironmentPreparedEvent( ApplicationEnvironmentPreparedEvent event) { if (this.loggingSystem == null) { - this.loggingSystem = LoggingSystem.get(event.getSpringApplication() - .getClassLoader()); + this.loggingSystem = LoggingSystem + .get(event.getSpringApplication().getClassLoader()); } initialize(event.getEnvironment(), event.getSpringApplication().getClassLoader()); } @@ -186,7 +189,8 @@ public class LoggingApplicationListener implements GenericApplicationListener { * @param environment the environment * @param classLoader the classloader */ - protected void initialize(ConfigurableEnvironment environment, ClassLoader classLoader) { + protected void initialize(ConfigurableEnvironment environment, + ClassLoader classLoader) { if (System.getProperty(PID_KEY) == null) { System.setProperty(PID_KEY, new ApplicationPid().toString()); } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java index b94f1c7894d..f16a2a25226 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java @@ -38,6 +38,7 @@ public abstract class LoggingSystem { public static final String SYSTEM_PROPERTY = LoggingSystem.class.getName(); private static final Map<String, String> SYSTEMS; + static { Map<String, String> systems = new LinkedHashMap<String, String>(); systems.put("ch.qos.logback.core.Appender", diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java index fe172f0846f..d48ed3752c3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java @@ -44,6 +44,7 @@ import org.springframework.util.StringUtils; public class JavaLoggingSystem extends AbstractLoggingSystem { private static final Map<LogLevel, Level> LEVELS; + static { Map<LogLevel, Level> levels = new HashMap<LogLevel, Level>(); levels.put(LogLevel.TRACE, Level.FINEST); @@ -91,8 +92,8 @@ public class JavaLoggingSystem extends AbstractLoggingSystem { protected void loadConfiguration(String location, LogFile logFile) { Assert.notNull(location, "Location must not be null"); try { - String configuration = FileCopyUtils.copyToString(new InputStreamReader( - ResourceUtils.getURL(location).openStream())); + String configuration = FileCopyUtils.copyToString( + new InputStreamReader(ResourceUtils.getURL(location).openStream())); if (logFile != null) { configuration = configuration.replace("${LOG_FILE}", StringUtils.cleanPath(logFile.toString())); @@ -101,8 +102,8 @@ public class JavaLoggingSystem extends AbstractLoggingSystem { new ByteArrayInputStream(configuration.getBytes())); } catch (Exception ex) { - throw new IllegalStateException("Could not initialize Java logging from " - + location, ex); + throw new IllegalStateException( + "Could not initialize Java logging from " + location, ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/log4j/Log4JLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/log4j/Log4JLoggingSystem.java index fab44a682ad..ad1c3ec2508 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/log4j/Log4JLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/log4j/Log4JLoggingSystem.java @@ -45,6 +45,7 @@ import org.springframework.util.StringUtils; public class Log4JLoggingSystem extends Slf4JLoggingSystem { private static final Map<LogLevel, Level> LEVELS; + static { Map<LogLevel, Level> levels = new HashMap<LogLevel, Level>(); levels.put(LogLevel.TRACE, Level.TRACE); @@ -98,8 +99,8 @@ public class Log4JLoggingSystem extends Slf4JLoggingSystem { Log4jConfigurer.initLogging(location); } catch (Exception ex) { - throw new IllegalStateException("Could not initialize Log4J logging from " - + location, ex); + throw new IllegalStateException( + "Could not initialize Log4J logging from " + location, ex); } } @@ -110,8 +111,8 @@ public class Log4JLoggingSystem extends Slf4JLoggingSystem { @Override public void setLogLevel(String loggerName, LogLevel level) { - Logger logger = (StringUtils.hasLength(loggerName) ? LogManager - .getLogger(loggerName) : LogManager.getRootLogger()); + Logger logger = (StringUtils.hasLength(loggerName) + ? LogManager.getLogger(loggerName) : LogManager.getRootLogger()); logger.setLevel(LEVELS.get(level)); } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java index 4bcc9c5909f..5e8fd0a48c1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java @@ -57,6 +57,7 @@ import org.springframework.util.ResourceUtils; public class Log4J2LoggingSystem extends Slf4JLoggingSystem { private static final Map<LogLevel, Level> LEVELS; + static { Map<LogLevel, Level> levels = new HashMap<LogLevel, Level>(); levels.put(LogLevel.TRACE, Level.TRACE); @@ -114,8 +115,8 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem { Collections.addAll(supportedConfigLocations, "log4j2.json", "log4j2.jsn"); } supportedConfigLocations.add("log4j2.xml"); - return supportedConfigLocations.toArray(new String[supportedConfigLocations - .size()]); + return supportedConfigLocations + .toArray(new String[supportedConfigLocations.size()]); } protected boolean isClassAvailable(String className) { @@ -164,8 +165,8 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem { ctx.start(ConfigurationFactory.getInstance().getConfiguration(source)); } catch (Exception ex) { - throw new IllegalStateException("Could not initialize Log4J2 logging from " - + location, ex); + throw new IllegalStateException( + "Could not initialize Log4J2 logging from " + location, ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java index a1838c5b39a..57c81cc445e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java @@ -39,6 +39,7 @@ import ch.qos.logback.core.pattern.CompositeConverter; public class ColorConverter extends CompositeConverter<ILoggingEvent> { private static final Map<String, AnsiElement> ELEMENTS; + static { Map<String, AnsiElement> elements = new HashMap<String, AnsiElement>(); elements.put("faint", AnsiStyle.FAINT); @@ -52,6 +53,7 @@ public class ColorConverter extends CompositeConverter<ILoggingEvent> { } private static final Map<Integer, AnsiElement> LEVELS; + static { Map<Integer, AnsiElement> levels = new HashMap<Integer, AnsiElement>(); levels.put(Level.ERROR_INTEGER, AnsiColor.RED); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java index 0c47d64ea9d..28df29f5ec9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java @@ -43,8 +43,8 @@ import ch.qos.logback.core.AppenderBase; */ public class LevelRemappingAppender extends AppenderBase<ILoggingEvent> { - private static final Map<Level, Level> DEFAULT_REMAPS = Collections.singletonMap( - Level.INFO, Level.DEBUG); + private static final Map<Level, Level> DEFAULT_REMAPS = Collections + .singletonMap(Level.INFO, Level.DEBUG); private String destinationLogger = Logger.ROOT_LOGGER_NAME; @@ -137,8 +137,8 @@ public class LevelRemappingAppender extends AppenderBase<ILoggingEvent> { @Override public Level getLevel() { - Level remappedLevel = LevelRemappingAppender.this.remapLevels.get(this.event - .getLevel()); + Level remappedLevel = LevelRemappingAppender.this.remapLevels + .get(this.event.getLevel()); return (remappedLevel == null ? this.event.getLevel() : remappedLevel); } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java index 40a357056af..aae4cc47ff0 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java @@ -86,8 +86,8 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { @Override protected String[] getStandardConfigLocations() { - return new String[] { "logback-test.groovy", "logback-test.xml", - "logback.groovy", "logback.xml" }; + return new String[] { "logback-test.groovy", "logback-test.xml", "logback.groovy", + "logback.xml" }; } @Override @@ -130,8 +130,8 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { ResourceUtils.getURL(location)); } catch (Exception ex) { - throw new IllegalStateException("Could not initialize Logback logging from " - + location, ex); + throw new IllegalStateException( + "Could not initialize Logback logging from " + location, ex); } List<Status> statuses = loggerContext.getStatusManager().getCopyOfStatusList(); StringBuilder errors = new StringBuilder(); @@ -200,20 +200,21 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { private ch.qos.logback.classic.Logger getLogger(String name) { LoggerContext factory = getLoggerContext(); - return factory.getLogger(StringUtils.isEmpty(name) ? Logger.ROOT_LOGGER_NAME - : name); + return factory + .getLogger(StringUtils.isEmpty(name) ? Logger.ROOT_LOGGER_NAME : name); } private LoggerContext getLoggerContext() { ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory(); - Assert.isInstanceOf(LoggerContext.class, factory, String.format( - "LoggerFactory is not a Logback LoggerContext but Logback is on " - + "the classpath. Either remove Logback or the competing " - + "implementation (%s loaded from %s). If you are using " - + "Weblogic you will need to add 'org.slf4j' to " - + "prefer-application-packages in WEB-INF/weblogic.xml", - factory.getClass(), getLocation(factory))); + Assert.isInstanceOf(LoggerContext.class, factory, + String.format( + "LoggerFactory is not a Logback LoggerContext but Logback is on " + + "the classpath. Either remove Logback or the competing " + + "implementation (%s loaded from %s). If you are using " + + "Weblogic you will need to add 'org.slf4j' to " + + "prefer-application-packages in WEB-INF/weblogic.xml", + factory.getClass(), getLocation(factory))); return (LoggerContext) factory; } diff --git a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityScanRegistrar.java b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityScanRegistrar.java index 0fcae80f4e4..b633de5478f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityScanRegistrar.java +++ b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityScanRegistrar.java @@ -60,8 +60,8 @@ class EntityScanRegistrar implements ImportBeanDefinitionRegistrar { } private Set<String> getPackagesToScan(AnnotationMetadata metadata) { - AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(EntityScan.class.getName())); + AnnotationAttributes attributes = AnnotationAttributes + .fromMap(metadata.getAnnotationAttributes(EntityScan.class.getName())); String[] value = attributes.getStringArray("value"); String[] basePackages = attributes.getStringArray("basePackages"); Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses"); @@ -76,8 +76,8 @@ class EntityScanRegistrar implements ImportBeanDefinitionRegistrar { packagesToScan.add(ClassUtils.getPackageName(basePackageClass)); } if (packagesToScan.isEmpty()) { - return Collections.singleton(ClassUtils.getPackageName(metadata - .getClassName())); + return Collections + .singleton(ClassUtils.getPackageName(metadata.getClassName())); } return packagesToScan; } @@ -86,8 +86,8 @@ class EntityScanRegistrar implements ImportBeanDefinitionRegistrar { Set<String> packagesToScan) { GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClass(EntityScanBeanPostProcessor.class); - beanDefinition.getConstructorArgumentValues().addGenericArgumentValue( - toArray(packagesToScan)); + beanDefinition.getConstructorArgumentValues() + .addGenericArgumentValue(toArray(packagesToScan)); beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); // We don't need this one to be post processed otherwise it can cause a // cascade of bean instantiation that we would rather avoid. @@ -115,8 +115,8 @@ class EntityScanRegistrar implements ImportBeanDefinitionRegistrar { * {@link LocalContainerEntityManagerFactoryBean#setPackagesToScan(String...)} based * on an {@link EntityScan} annotation. */ - static class EntityScanBeanPostProcessor implements BeanPostProcessor, - SmartInitializingSingleton, Ordered { + static class EntityScanBeanPostProcessor + implements BeanPostProcessor, SmartInitializingSingleton, Ordered { private final String[] packagesToScan; @@ -145,9 +145,10 @@ class EntityScanRegistrar implements ImportBeanDefinitionRegistrar { @Override public void afterSingletonsInstantiated() { - Assert.state(this.processed, "Unable to configure " - + "LocalContainerEntityManagerFactoryBean from @EntityScan, " - + "ensure an appropriate bean is registered."); + Assert.state(this.processed, + "Unable to configure " + + "LocalContainerEntityManagerFactoryBean from @EntityScan, " + + "ensure an appropriate bean is registered."); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java index 7c905b6cc8d..6a2f7c0c9bb 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java @@ -29,8 +29,8 @@ import org.springframework.test.context.ContextConfiguration; * @author Phillip Webb * @see ConfigFileEnvironmentPostProcessor */ -public class ConfigFileApplicationContextInitializer implements - ApplicationContextInitializer<ConfigurableApplicationContext> { +public class ConfigFileApplicationContextInitializer + implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(final ConfigurableApplicationContext applicationContext) { diff --git a/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java b/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java index 6c776d25ad1..aaf17897a3a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java @@ -44,7 +44,8 @@ public class IntegrationTestPropertiesListener extends AbstractTestExecutionList } } - private void addPropertySourceProperties(TestContext testContext, String[] properties) { + private void addPropertySourceProperties(TestContext testContext, + String[] properties) { try { MergedContextConfiguration configuration = (MergedContextConfiguration) ReflectionTestUtils .getField(testContext, "mergedContextConfiguration"); diff --git a/spring-boot/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java b/spring-boot/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java index 73db30947d9..e68842baacb 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java @@ -44,8 +44,8 @@ class WebAppIntegrationTestContextBootstrapper extends DefaultTestContextBootstr @Override protected MergedContextConfiguration processMergedContextConfiguration( MergedContextConfiguration mergedConfig) { - WebIntegrationTest annotation = AnnotationUtils.findAnnotation( - mergedConfig.getTestClass(), WebIntegrationTest.class); + WebIntegrationTest annotation = AnnotationUtils + .findAnnotation(mergedConfig.getTestClass(), WebIntegrationTest.class); if (annotation != null) { mergedConfig = new WebMergedContextConfiguration(mergedConfig, null); MergedContextConfigurationProperties properties = new MergedContextConfigurationProperties( diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxView.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxView.java index 7859e9b33fb..b109b40f10d 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxView.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxView.java @@ -93,9 +93,9 @@ public class EmbeddedVelocityToolboxView extends VelocityToolboxView { InputStream inputStream = (InputStream) invocation.proceed(); if (inputStream == null) { try { - inputStream = new ClassPathResource(this.toolboxFile, Thread - .currentThread().getContextClassLoader()) - .getInputStream(); + inputStream = new ClassPathResource(this.toolboxFile, + Thread.currentThread().getContextClassLoader()) + .getInputStream(); } catch (Exception ex) { // Ignore diff --git a/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java index 806420dbd6c..8aef55542ff 100644 --- a/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java @@ -57,7 +57,8 @@ public class BeanDefinitionLoaderTests { @Test public void loadXmlResource() throws Exception { - ClassPathResource resource = new ClassPathResource("sample-beans.xml", getClass()); + ClassPathResource resource = new ClassPathResource("sample-beans.xml", + getClass()); BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, resource); int loaded = loader.load(); assertThat(loaded, equalTo(1)); diff --git a/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java b/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java index 9704a983cac..93f4cc4da5d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java @@ -50,8 +50,8 @@ public class SimpleMainTests { @Test public void basePackageScan() throws Exception { - SpringApplication.main(getArgs(ClassUtils.getPackageName(getClass()) - + ".sampleconfig")); + SpringApplication + .main(getArgs(ClassUtils.getPackageName(getClass()) + ".sampleconfig")); assertTrue(getOutput().contains(SPRING_STARTUP)); } 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 7a612db449c..1af849dfea1 100644 --- a/spring-boot/src/test/java/org/springframework/boot/StartUpLoggerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/StartUpLoggerTests.java @@ -41,8 +41,8 @@ public class StartUpLoggerTests { @Test public void sourceClassIncluded() { new StartupInfoLogger(getClass()).logStarting(this.log); - assertTrue("Wrong output: " + this.output, - this.output.toString().contains("Starting " + getClass().getSimpleName())); + assertTrue("Wrong output: " + this.output, this.output.toString() + .contains("Starting " + getClass().getSimpleName())); } } diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java index ae337b2b084..cc45449a121 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java @@ -66,8 +66,8 @@ public class PropertiesConfigurationFactoryMapTests { this.targetName = "foo"; setupFactory(); MutablePropertySources sources = new MutablePropertySources(); - sources.addFirst(new MapPropertySource("map", Collections.singletonMap( - "foo.map.name", (Object) "blah"))); + sources.addFirst(new MapPropertySource("map", + Collections.singletonMap("foo.map.name", (Object) "blah"))); this.factory.setPropertySources(sources); this.factory.afterPropertiesSet(); Foo foo = this.factory.getObject(); @@ -80,8 +80,8 @@ public class PropertiesConfigurationFactoryMapTests { setupFactory(); MutablePropertySources sources = new MutablePropertySources(); CompositePropertySource composite = new CompositePropertySource("composite"); - composite.addPropertySource(new MapPropertySource("map", Collections - .singletonMap("foo.map.name", (Object) "blah"))); + composite.addPropertySource(new MapPropertySource("map", + Collections.singletonMap("foo.map.name", (Object) "blah"))); sources.addFirst(composite); this.factory.setPropertySources(sources); this.factory.afterPropertiesSet(); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java index aefc48d153d..67e793c93e8 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java @@ -74,15 +74,15 @@ public class PropertiesConfigurationFactoryTests { @Test(expected = BindException.class) public void testMissingPropertyCausesValidationError() throws Exception { - this.validator = new SpringValidatorAdapter(Validation - .buildDefaultValidatorFactory().getValidator()); + this.validator = new SpringValidatorAdapter( + Validation.buildDefaultValidatorFactory().getValidator()); createFoo("bar: blah"); } @Test public void testValidationErrorCanBeSuppressed() throws Exception { - this.validator = new SpringValidatorAdapter(Validation - .buildDefaultValidatorFactory().getValidator()); + this.validator = new SpringValidatorAdapter( + Validation.buildDefaultValidatorFactory().getValidator()); setupFactory(); this.factory.setExceptionIfInvalid(false); bindFoo("bar: blah"); 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 b480c97486b..5d7fb8fafd2 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 @@ -60,8 +60,8 @@ public class PropertySourcesPropertyValuesTests { } }); - this.propertySources.addFirst(new MapPropertySource("map", Collections - .<String, Object>singletonMap("name", "${foo}"))); + this.propertySources.addFirst(new MapPropertySource("map", + Collections.<String, Object>singletonMap("name", "${foo}"))); } @Test @@ -146,8 +146,8 @@ public class PropertySourcesPropertyValuesTests { @Test public void testOverriddenValue() { - this.propertySources.addFirst(new MapPropertySource("new", Collections - .<String, Object>singletonMap("name", "spam"))); + this.propertySources.addFirst(new MapPropertySource("new", + Collections.<String, Object>singletonMap("name", "spam"))); PropertySourcesPropertyValues propertyValues = new PropertySourcesPropertyValues( this.propertySources); assertEquals("spam", propertyValues.getPropertyValue("name").getValue()); @@ -174,8 +174,8 @@ public class PropertySourcesPropertyValuesTests { public void testPlaceholdersBindingWithError() { TestBean target = new TestBean(); DataBinder binder = new DataBinder(target); - this.propertySources.addFirst(new MapPropertySource("another", Collections - .<String, Object>singletonMap("something", "${nonexistent}"))); + this.propertySources.addFirst(new MapPropertySource("another", + Collections.<String, Object>singletonMap("something", "${nonexistent}"))); binder.bind(new PropertySourcesPropertyValues(this.propertySources)); assertEquals("bar", target.getName()); } 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 a7f56669896..7f1fec63a82 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 @@ -185,8 +185,8 @@ public class RelaxedDataBinderTests { BindingResult result = bind(target, "info[foo]: bar"); assertEquals(2, result.getErrorCount()); for (FieldError error : result.getFieldErrors()) { - System.err.println(new StaticMessageSource().getMessage(error, - Locale.getDefault())); + System.err.println( + new StaticMessageSource().getMessage(error, Locale.getDefault())); } } @@ -196,8 +196,8 @@ public class RelaxedDataBinderTests { RelaxedDataBinder binder = getBinder(target, null); binder.setAllowedFields("foo"); binder.setIgnoreUnknownFields(false); - BindingResult result = bind(binder, target, "foo: bar\n" + "value: 123\n" - + "bar: spam"); + BindingResult result = bind(binder, target, + "foo: bar\n" + "value: 123\n" + "bar: spam"); assertEquals(0, target.getValue()); assertEquals("bar", target.getFoo()); assertEquals(0, result.getErrorCount()); @@ -210,8 +210,8 @@ public class RelaxedDataBinderTests { // Disallowed fields are not unknown... binder.setDisallowedFields("foo", "bar"); binder.setIgnoreUnknownFields(false); - BindingResult result = bind(binder, target, "foo: bar\n" + "value: 123\n" - + "bar: spam"); + BindingResult result = bind(binder, target, + "foo: bar\n" + "value: 123\n" + "bar: spam"); assertEquals(123, target.getValue()); assertNull(target.getFoo()); assertEquals(0, result.getErrorCount()); @@ -493,8 +493,8 @@ public class RelaxedDataBinderTests { RelaxedDataBinder binder = getBinder(target, null); binder.setIgnoreUnknownFields(false); binder.setIgnoreNestedProperties(true); - BindingResult result = bind(binder, target, "foo: bar\n" + "value: 123\n" - + "nested.bar: spam"); + BindingResult result = bind(binder, target, + "foo: bar\n" + "value: 123\n" + "nested.bar: spam"); assertEquals(123, target.getValue()); assertEquals("bar", target.getFoo()); assertEquals(0, result.getErrorCount()); @@ -506,8 +506,8 @@ public class RelaxedDataBinderTests { RelaxedDataBinder binder = getBinder(target, "foo"); binder.setIgnoreUnknownFields(false); binder.setIgnoreNestedProperties(true); - BindingResult result = bind(binder, target, "foo.foo: bar\n" + "foo.value: 123\n" - + "foo.nested.bar: spam"); + BindingResult result = bind(binder, target, + "foo.foo: bar\n" + "foo.value: 123\n" + "foo.nested.bar: spam"); assertEquals(123, target.getValue()); assertEquals("bar", target.getFoo()); assertEquals(0, result.getErrorCount()); @@ -525,8 +525,8 @@ public class RelaxedDataBinderTests { @Test public void testBindMapWithClashInProperties() throws Exception { Map<String, Object> target = new LinkedHashMap<String, Object>(); - BindingResult result = bind(target, "vanilla.spam: bar\n" - + "vanilla.spam.value: 123", "vanilla"); + BindingResult result = bind(target, + "vanilla.spam: bar\n" + "vanilla.spam.value: 123", "vanilla"); assertEquals(0, result.getErrorCount()); assertEquals(2, target.size()); assertEquals("bar", target.get("spam")); @@ -536,8 +536,8 @@ public class RelaxedDataBinderTests { @Test public void testBindMapWithDeepClashInProperties() throws Exception { Map<String, Object> target = new LinkedHashMap<String, Object>(); - BindingResult result = bind(target, "vanilla.spam.foo: bar\n" - + "vanilla.spam.foo.value: 123", "vanilla"); + BindingResult result = bind(target, + "vanilla.spam.foo: bar\n" + "vanilla.spam.foo.value: 123", "vanilla"); assertEquals(0, result.getErrorCount()); @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) target.get("spam"); @@ -547,8 +547,8 @@ public class RelaxedDataBinderTests { @Test public void testBindMapWithDifferentDeepClashInProperties() throws Exception { Map<String, Object> target = new LinkedHashMap<String, Object>(); - BindingResult result = bind(target, "vanilla.spam.bar: bar\n" - + "vanilla.spam.bar.value: 123", "vanilla"); + BindingResult result = bind(target, + "vanilla.spam.bar: bar\n" + "vanilla.spam.bar.value: 123", "vanilla"); assertEquals(0, result.getErrorCount()); @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) target.get("spam"); @@ -709,8 +709,8 @@ public class RelaxedDataBinderTests { } - public static class RequiredKeysValidator implements - ConstraintValidator<RequiredKeys, Map<String, Object>> { + public static class RequiredKeysValidator + implements ConstraintValidator<RequiredKeys, Map<String, Object>> { private String[] fields; diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java index d4271e67a39..924cfc14000 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java @@ -58,8 +58,8 @@ public class RelaxedPropertyResolverTests { this.source.put("myobject", "object"); this.source.put("myInteger", 123); this.source.put("myClass", "java.lang.String"); - this.environment.getPropertySources().addFirst( - new MapPropertySource("test", this.source)); + this.environment.getPropertySources() + .addFirst(new MapPropertySource("test", this.source)); this.resolver = new RelaxedPropertyResolver(this.environment); } 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 f9cc8713640..c7540eaaf1e 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 @@ -87,8 +87,8 @@ public class YamlConfigurationFactoryTests { @Test(expected = BindException.class) public void missingPropertyCausesValidationError() throws Exception { - this.validator = new SpringValidatorAdapter(Validation - .buildDefaultValidatorFactory().getValidator()); + this.validator = new SpringValidatorAdapter( + Validation.buildDefaultValidatorFactory().getValidator()); createFoo("bar: blah"); } 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 f54901f9d12..e2c96191b7a 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 @@ -60,9 +60,8 @@ public class SpringApplicationBuilderTests { @Test public void profileAndProperties() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder() - .sources(ExampleConfig.class) - .contextClass(StaticApplicationContext.class).profiles("foo") - .properties("foo=bar"); + .sources(ExampleConfig.class).contextClass(StaticApplicationContext.class) + .profiles("foo").properties("foo=bar"); this.context = application.run(); assertThat(this.context, is(instanceOf(StaticApplicationContext.class))); assertThat(this.context.getEnvironment().getProperty("foo"), @@ -73,8 +72,7 @@ public class SpringApplicationBuilderTests { @Test public void propertiesAsMap() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder() - .sources(ExampleConfig.class) - .contextClass(StaticApplicationContext.class) + .sources(ExampleConfig.class).contextClass(StaticApplicationContext.class) .properties(Collections.<String, Object>singletonMap("bar", "foo")); this.context = application.run(); assertThat(this.context.getEnvironment().getProperty("bar"), is(equalTo("foo"))); @@ -83,19 +81,18 @@ public class SpringApplicationBuilderTests { @Test public void propertiesAsProperties() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder() - .sources(ExampleConfig.class) - .contextClass(StaticApplicationContext.class) - .properties( - StringUtils.splitArrayElementsIntoProperties( - new String[] { "bar=foo" }, "=")); + .sources(ExampleConfig.class).contextClass(StaticApplicationContext.class) + .properties(StringUtils.splitArrayElementsIntoProperties( + new String[] { "bar=foo" }, "=")); this.context = application.run(); assertThat(this.context.getEnvironment().getProperty("bar"), is(equalTo("foo"))); } @Test public void specificApplicationContextClass() throws Exception { - SpringApplicationBuilder application = new SpringApplicationBuilder().sources( - ExampleConfig.class).contextClass(StaticApplicationContext.class); + SpringApplicationBuilder application = new SpringApplicationBuilder() + .sources(ExampleConfig.class) + .contextClass(StaticApplicationContext.class); this.context = application.run(); assertThat(this.context, is(instanceOf(StaticApplicationContext.class))); } @@ -106,8 +103,8 @@ public class SpringApplicationBuilderTests { ChildConfig.class).contextClass(SpyApplicationContext.class); application.parent(ExampleConfig.class); this.context = application.run(); - verify(((SpyApplicationContext) this.context).getApplicationContext()).setParent( - any(ApplicationContext.class)); + verify(((SpyApplicationContext) this.context).getApplicationContext()) + .setParent(any(ApplicationContext.class)); assertThat(((SpyApplicationContext) this.context).getRegisteredShutdownHook(), equalTo(false)); } @@ -116,11 +113,11 @@ public class SpringApplicationBuilderTests { public void parentContextCreationWithChildShutdown() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ChildConfig.class).contextClass(SpyApplicationContext.class) - .registerShutdownHook(true); + .registerShutdownHook(true); application.parent(ExampleConfig.class); this.context = application.run(); - verify(((SpyApplicationContext) this.context).getApplicationContext()).setParent( - any(ApplicationContext.class)); + verify(((SpyApplicationContext) this.context).getApplicationContext()) + .setParent(any(ApplicationContext.class)); assertThat(((SpyApplicationContext) this.context).getRegisteredShutdownHook(), equalTo(true)); } @@ -129,8 +126,8 @@ public class SpringApplicationBuilderTests { public void contextWithClassLoader() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).contextClass(SpyApplicationContext.class); - ClassLoader classLoader = new URLClassLoader(new URL[0], getClass() - .getClassLoader()); + ClassLoader classLoader = new URLClassLoader(new URL[0], + getClass().getClassLoader()); application.resourceLoader(new DefaultResourceLoader(classLoader)); this.context = application.run(); assertThat(((SpyApplicationContext) this.context).getClassLoader(), @@ -141,8 +138,8 @@ public class SpringApplicationBuilderTests { public void parentContextWithClassLoader() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ChildConfig.class).contextClass(SpyApplicationContext.class); - ClassLoader classLoader = new URLClassLoader(new URL[0], getClass() - .getClassLoader()); + ClassLoader classLoader = new URLClassLoader(new URL[0], + getClass().getClassLoader()); application.resourceLoader(new DefaultResourceLoader(classLoader)); application.parent(ExampleConfig.class); this.context = application.run(); @@ -156,8 +153,8 @@ public class SpringApplicationBuilderTests { ExampleConfig.class).child(ChildConfig.class); application.contextClass(SpyApplicationContext.class); this.context = application.run(); - verify(((SpyApplicationContext) this.context).getApplicationContext()).setParent( - any(ApplicationContext.class)); + verify(((SpyApplicationContext) this.context).getApplicationContext()) + .setParent(any(ApplicationContext.class)); assertThat(((SpyApplicationContext) this.context).getRegisteredShutdownHook(), equalTo(false)); } @@ -166,7 +163,7 @@ public class SpringApplicationBuilderTests { public void parentFirstCreationWithProfileAndDefaultArgs() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).profiles("node").properties("transport=redis") - .child(ChildConfig.class).web(false); + .child(ChildConfig.class).web(false); this.context = application.run(); assertThat(this.context.getEnvironment().acceptsProfiles("node"), is(true)); assertThat(this.context.getEnvironment().getProperty("transport"), @@ -183,7 +180,7 @@ public class SpringApplicationBuilderTests { public void parentFirstWithDifferentProfile() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).profiles("node").properties("transport=redis") - .child(ChildConfig.class).profiles("admin").web(false); + .child(ChildConfig.class).profiles("admin").web(false); this.context = application.run(); assertThat(this.context.getEnvironment().acceptsProfiles("node", "admin"), is(true)); @@ -201,9 +198,8 @@ public class SpringApplicationBuilderTests { this.context = application.run(); assertThat(this.context.getEnvironment().acceptsProfiles("node", "admin"), is(true)); - assertThat( - this.context.getParent().getEnvironment() - .acceptsProfiles("node", "parent"), is(true)); + assertThat(this.context.getParent().getEnvironment().acceptsProfiles("node", + "parent"), is(true)); assertThat(this.context.getParent().getEnvironment().acceptsProfiles("admin"), is(false)); } @@ -212,8 +208,8 @@ public class SpringApplicationBuilderTests { public void parentFirstWithDifferentProfileAndExplicitEnvironment() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).environment(new StandardEnvironment()) - .profiles("node").properties("transport=redis").child(ChildConfig.class) - .profiles("admin").web(false); + .profiles("node").properties("transport=redis") + .child(ChildConfig.class).profiles("admin").web(false); this.context = application.run(); assertThat(this.context.getEnvironment().acceptsProfiles("node", "admin"), is(true)); @@ -230,8 +226,8 @@ public class SpringApplicationBuilderTests { application.parent(ExampleConfig.class); application.contextClass(SpyApplicationContext.class); this.context = application.run(); - verify(((SpyApplicationContext) this.context).getApplicationContext()).setParent( - any(ApplicationContext.class)); + verify(((SpyApplicationContext) this.context).getApplicationContext()) + .setParent(any(ApplicationContext.class)); } @Test @@ -254,12 +250,12 @@ public class SpringApplicationBuilderTests { public void initializersIncludeDefaults() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).web(false).initializers( - new ApplicationContextInitializer<ConfigurableApplicationContext>() { - @Override - public void initialize( - ConfigurableApplicationContext applicationContext) { - } - }); + new ApplicationContextInitializer<ConfigurableApplicationContext>() { + @Override + public void initialize( + ConfigurableApplicationContext applicationContext) { + } + }); this.context = application.run(); assertEquals(5, application.application().getInitializers().size()); } @@ -276,7 +272,8 @@ public class SpringApplicationBuilderTests { public static class SpyApplicationContext extends AnnotationConfigApplicationContext { - private final ConfigurableApplicationContext applicationContext = spy(new AnnotationConfigApplicationContext()); + private final ConfigurableApplicationContext applicationContext = spy( + new AnnotationConfigApplicationContext()); private ResourceLoader resourceLoader; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java index 2ec5ee5e53a..a1e26f7558f 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java @@ -106,8 +106,8 @@ public class ConfigurationWarningsApplicationContextInitializerTests { /** * Testable version of {@link ConfigurationWarningsApplicationContextInitializer}. */ - public static class TestConfigurationWarningsApplicationContextInitializer extends - ConfigurationWarningsApplicationContextInitializer { + public static class TestConfigurationWarningsApplicationContextInitializer + extends ConfigurationWarningsApplicationContextInitializer { @Override protected Check[] getChecks() { @@ -120,8 +120,8 @@ public class ConfigurationWarningsApplicationContextInitializerTests { * Testable ComponentScanDefaultPackageCheck that doesn't need to use the default * package. */ - static class TestComponentScanDefaultPackageCheck extends - ComponentScanDefaultPackageCheck { + static class TestComponentScanDefaultPackageCheck + extends ComponentScanDefaultPackageCheck { @Override protected boolean isInDefaultPackage(String className) { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java index fd32bb6122b..481b92e4c8c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java @@ -78,8 +78,8 @@ public class DelegatingApplicationContextInitializerTests { @Test public void notAnInitializerClass() throws Exception { StaticApplicationContext context = new StaticApplicationContext(); - EnvironmentTestUtils.addEnvironment(context, "context.initializer.classes:" - + Object.class.getName()); + EnvironmentTestUtils.addEnvironment(context, + "context.initializer.classes:" + Object.class.getName()); this.thrown.expect(IllegalArgumentException.class); this.initializer.initialize(context); } @@ -87,16 +87,16 @@ public class DelegatingApplicationContextInitializerTests { @Test public void genericNotSuitable() throws Exception { StaticApplicationContext context = new StaticApplicationContext(); - EnvironmentTestUtils.addEnvironment(context, "context.initializer.classes:" - + NotSuitableInit.class.getName()); + EnvironmentTestUtils.addEnvironment(context, + "context.initializer.classes:" + NotSuitableInit.class.getName()); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("generic parameter"); this.initializer.initialize(context); } @Order(Ordered.HIGHEST_PRECEDENCE) - private static class MockInitA implements - ApplicationContextInitializer<ConfigurableApplicationContext> { + private static class MockInitA + implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(ConfigurableApplicationContext applicationContext) { applicationContext.getBeanFactory().registerSingleton("a", "a"); @@ -104,8 +104,8 @@ public class DelegatingApplicationContextInitializerTests { } @Order(Ordered.LOWEST_PRECEDENCE) - private static class MockInitB implements - ApplicationContextInitializer<ConfigurableApplicationContext> { + private static class MockInitB + implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(ConfigurableApplicationContext applicationContext) { assertThat(applicationContext.getBeanFactory().getSingleton("a"), @@ -114,8 +114,8 @@ public class DelegatingApplicationContextInitializerTests { } } - private static class NotSuitableInit implements - ApplicationContextInitializer<ConfigurableWebApplicationContext> { + private static class NotSuitableInit + implements ApplicationContextInitializer<ConfigurableWebApplicationContext> { @Override public void initialize(ConfigurableWebApplicationContext applicationContext) { } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java index 4480ec5eb79..d0fd06f1b66 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java @@ -62,8 +62,10 @@ public class DelegatingApplicationListenerTests { new SpringApplication(), new String[0], this.context.getEnvironment())); this.context.getBeanFactory().registerSingleton("testListener", this.listener); this.context.refresh(); - assertThat(this.context.getBeanFactory().getSingleton("a"), equalTo((Object) "a")); - assertThat(this.context.getBeanFactory().getSingleton("b"), equalTo((Object) "b")); + assertThat(this.context.getBeanFactory().getSingleton("a"), + equalTo((Object) "a")); + assertThat(this.context.getBeanFactory().getSingleton("b"), + equalTo((Object) "b")); } @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java index f31c3b03c4c..1e4ee86bbf3 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java @@ -91,8 +91,8 @@ public class AnnotationConfigEmbeddedWebApplicationContextTests { @Test public void scanAndRefresh() throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext(); - this.context.scan(ExampleEmbeddedWebApplicationConfiguration.class.getPackage() - .getName()); + this.context.scan( + ExampleEmbeddedWebApplicationConfiguration.class.getPackage().getName()); this.context.refresh(); verifyContext(); } @@ -152,8 +152,8 @@ public class AnnotationConfigEmbeddedWebApplicationContextTests { @Configuration @EnableWebMvc - public static class ServletContextAwareEmbeddedConfiguration implements - ServletContextAware { + public static class ServletContextAwareEmbeddedConfiguration + implements ServletContextAware { private ServletContext servletContext; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java index 049d47230db..dde9e51bbc5 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java @@ -96,9 +96,10 @@ public class EmbeddedServletContainerMvcIntegrationTests { private void doTest(AnnotationConfigEmbeddedWebApplicationContext context, String resourcePath) throws Exception { SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory(); - ClientHttpRequest request = clientHttpRequestFactory.createRequest(new URI( - "http://localhost:" + context.getEmbeddedServletContainer().getPort() - + resourcePath), HttpMethod.GET); + ClientHttpRequest request = clientHttpRequestFactory.createRequest( + new URI("http://localhost:" + + context.getEmbeddedServletContainer().getPort() + resourcePath), + HttpMethod.GET); ClientHttpResponse response = request.execute(); try { String actual = StreamUtils.copyToString(response.getBody(), diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java index d34ea12aae5..549dac852af 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java @@ -109,15 +109,13 @@ public class EmbeddedWebApplicationContextTests { // Ensure WebApplicationContextUtils.registerWebApplicationScopes was called assertThat( - this.context.getBeanFactory().getRegisteredScope( - WebApplicationContext.SCOPE_SESSION), + this.context.getBeanFactory() + .getRegisteredScope(WebApplicationContext.SCOPE_SESSION), instanceOf(SessionScope.class)); // Ensure WebApplicationContextUtils.registerEnvironmentBeans was called - assertThat( - this.context - .containsBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME), - equalTo(true)); + assertThat(this.context.containsBean( + WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME), equalTo(true)); } @Test @@ -137,11 +135,11 @@ public class EmbeddedWebApplicationContextTests { @Test public void containerEventPublished() throws Exception { addEmbeddedServletContainerFactoryBean(); - this.context.registerBeanDefinition("listener", new RootBeanDefinition( - MockListener.class)); + this.context.registerBeanDefinition("listener", + new RootBeanDefinition(MockListener.class)); this.context.refresh(); - EmbeddedServletContainerInitializedEvent event = this.context.getBean( - MockListener.class).getEvent(); + EmbeddedServletContainerInitializedEvent event = this.context + .getBean(MockListener.class).getEvent(); assertNotNull(event); assertTrue(event.getSource().getPort() >= 0); assertEquals(this.context, event.getApplicationContext()); @@ -249,10 +247,10 @@ public class EmbeddedWebApplicationContextTests { InOrder ordered = inOrder(servletContext); ordered.verify(servletContext).addServlet("servletBean1", servlet1); ordered.verify(servletContext).addServlet("servletBean2", servlet2); - verify(escf.getRegisteredServlet(0).getRegistration()).addMapping( - "/servletBean1/"); - verify(escf.getRegisteredServlet(1).getRegistration()).addMapping( - "/servletBean2/"); + verify(escf.getRegisteredServlet(0).getRegistration()) + .addMapping("/servletBean1/"); + verify(escf.getRegisteredServlet(1).getRegistration()) + .addMapping("/servletBean2/"); } @Test @@ -265,8 +263,8 @@ public class EmbeddedWebApplicationContextTests { withSettings().extraInterfaces(Ordered.class)); given(((Ordered) servlet2).getOrder()).willReturn(2); this.context.registerBeanDefinition("servletBean2", beanDefinition(servlet2)); - this.context - .registerBeanDefinition("dispatcherServlet", beanDefinition(servlet1)); + this.context.registerBeanDefinition("dispatcherServlet", + beanDefinition(servlet1)); this.context.refresh(); MockEmbeddedServletContainerFactory escf = getEmbeddedServletContainerFactory(); ServletContext servletContext = escf.getServletContext(); @@ -274,17 +272,19 @@ public class EmbeddedWebApplicationContextTests { ordered.verify(servletContext).addServlet("dispatcherServlet", servlet1); ordered.verify(servletContext).addServlet("servletBean2", servlet2); verify(escf.getRegisteredServlet(0).getRegistration()).addMapping("/"); - verify(escf.getRegisteredServlet(1).getRegistration()).addMapping( - "/servletBean2/"); + verify(escf.getRegisteredServlet(1).getRegistration()) + .addMapping("/servletBean2/"); } @Test public void servletAndFilterBeans() throws Exception { addEmbeddedServletContainerFactoryBean(); Servlet servlet = mock(Servlet.class); - Filter filter1 = mock(Filter.class, withSettings().extraInterfaces(Ordered.class)); + Filter filter1 = mock(Filter.class, + withSettings().extraInterfaces(Ordered.class)); given(((Ordered) filter1).getOrder()).willReturn(1); - Filter filter2 = mock(Filter.class, withSettings().extraInterfaces(Ordered.class)); + Filter filter2 = mock(Filter.class, + withSettings().extraInterfaces(Ordered.class)); given(((Ordered) filter2).getOrder()).willReturn(2); this.context.registerBeanDefinition("servletBean", beanDefinition(servlet)); this.context.registerBeanDefinition("filterBean2", beanDefinition(filter2)); @@ -377,7 +377,8 @@ public class EmbeddedWebApplicationContextTests { addEmbeddedServletContainerFactoryBean(); Servlet servlet = mock(Servlet.class); Filter filter = mock(Filter.class); - ServletRegistrationBean initializer = new ServletRegistrationBean(servlet, "/foo"); + ServletRegistrationBean initializer = new ServletRegistrationBean(servlet, + "/foo"); this.context.registerBeanDefinition("initializerBean", beanDefinition(initializer)); this.context.registerBeanDefinition("servletBean", beanDefinition(servlet)); @@ -437,8 +438,7 @@ public class EmbeddedWebApplicationContextTests { sameInstance(scope)); assertThat(factory.getRegisteredScope(WebApplicationContext.SCOPE_SESSION), sameInstance(scope)); - assertThat( - factory.getRegisteredScope(WebApplicationContext.SCOPE_GLOBAL_SESSION), + assertThat(factory.getRegisteredScope(WebApplicationContext.SCOPE_GLOBAL_SESSION), sameInstance(scope)); } @@ -465,8 +465,8 @@ public class EmbeddedWebApplicationContextTests { return object; } - public static class MockListener implements - ApplicationListener<EmbeddedServletContainerInitializedEvent> { + public static class MockListener + implements ApplicationListener<EmbeddedServletContainerInitializedEvent> { private EmbeddedServletContainerInitializedEvent event; 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 ee5d0c0c632..692c31a5ed6 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 @@ -88,8 +88,8 @@ public class FilterRegistrationBeanTests { bean.addUrlPatterns("/c"); bean.setServletNames(new LinkedHashSet<String>(Arrays.asList("s1", "s2"))); bean.addServletNames("s3"); - bean.setServletRegistrationBeans(Collections - .singleton(mockServletRegistation("s4"))); + bean.setServletRegistrationBeans( + Collections.singleton(mockServletRegistation("s4"))); bean.addServletRegistrationBeans(mockServletRegistation("s5")); bean.setMatchAfter(true); bean.onStartup(this.servletContext); @@ -99,13 +99,12 @@ public class FilterRegistrationBeanTests { expectedInitParameters.put("a", "b"); expectedInitParameters.put("c", "d"); verify(this.registration).setInitParameters(expectedInitParameters); - verify(this.registration) - .addMappingForUrlPatterns( - FilterRegistrationBean.NON_ASYNC_DISPATCHER_TYPES, true, "/a", - "/b", "/c"); + verify(this.registration).addMappingForUrlPatterns( + FilterRegistrationBean.NON_ASYNC_DISPATCHER_TYPES, true, "/a", "/b", + "/c"); verify(this.registration).addMappingForServletNames( - FilterRegistrationBean.NON_ASYNC_DISPATCHER_TYPES, true, "s4", "s5", - "s1", "s2", "s3"); + FilterRegistrationBean.NON_ASYNC_DISPATCHER_TYPES, true, "s4", "s5", "s1", + "s2", "s3"); } @Test 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 840e9221a43..4e3b78b5937 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 @@ -47,8 +47,8 @@ import static org.mockito.Mockito.spy; * @author Phillip Webb * @author Andy Wilkinson */ -public class MockEmbeddedServletContainerFactory extends - AbstractEmbeddedServletContainerFactory { +public class MockEmbeddedServletContainerFactory + extends AbstractEmbeddedServletContainerFactory { private MockEmbeddedServletContainer container; @@ -69,13 +69,13 @@ public class MockEmbeddedServletContainerFactory extends } public RegisteredServlet getRegisteredServlet(int index) { - return getContainer() == null ? null : getContainer().getRegisteredServlets() - .get(index); + return getContainer() == null ? null + : getContainer().getRegisteredServlets().get(index); } public RegisteredFilter getRegisteredFilter(int index) { - return getContainer() == null ? null : getContainer().getRegisteredFilters().get( - index); + return getContainer() == null ? null + : getContainer().getRegisteredFilters().get(index); } public static class MockEmbeddedServletContainer implements EmbeddedServletContainer { @@ -137,21 +137,21 @@ public class MockEmbeddedServletContainerFactory extends } }); - given(this.servletContext.getInitParameterNames()).willReturn( - Collections.enumeration(initParameters.keySet())); - given(this.servletContext.getInitParameter(anyString())).willAnswer( - new Answer<String>() { + given(this.servletContext.getInitParameterNames()) + .willReturn(Collections.enumeration(initParameters.keySet())); + given(this.servletContext.getInitParameter(anyString())) + .willAnswer(new Answer<String>() { @Override public String answer(InvocationOnMock invocation) throws Throwable { - return initParameters.get(invocation.getArgumentAt(0, - String.class)); + return initParameters + .get(invocation.getArgumentAt(0, String.class)); } }); given(this.servletContext.getAttributeNames()).willReturn( MockEmbeddedServletContainer.<String>emptyEnumeration()); - given(this.servletContext.getNamedDispatcher("default")).willReturn( - mock(RequestDispatcher.class)); + given(this.servletContext.getNamedDispatcher("default")) + .willReturn(mock(RequestDispatcher.class)); for (ServletContextInitializer initializer : this.initializers) { initializer.onStartup(this.servletContext); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockServlet.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockServlet.java index 500f8f9e277..9f48ba3ac5e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockServlet.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockServlet.java @@ -32,8 +32,8 @@ import javax.servlet.ServletResponse; public class MockServlet extends GenericServlet { @Override - public void service(ServletRequest req, ServletResponse res) throws ServletException, - IOException { + public void service(ServletRequest req, ServletResponse res) + throws ServletException, IOException { } } 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 d7523468105..d61f60263fe 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 @@ -67,8 +67,8 @@ public class ServletListenerRegistrationBeanTests { this.listener); bean.setEnabled(false); bean.onStartup(this.servletContext); - verify(this.servletContext, times(0)).addListener( - any(ServletContextListener.class)); + verify(this.servletContext, times(0)) + .addListener(any(ServletContextListener.class)); } @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/XmlEmbeddedWebApplicationContextTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/XmlEmbeddedWebApplicationContextTests.java index 24e888f1f4a..2173ffecaf2 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/XmlEmbeddedWebApplicationContextTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/XmlEmbeddedWebApplicationContextTests.java @@ -31,8 +31,7 @@ import static org.mockito.Mockito.verify; public class XmlEmbeddedWebApplicationContextTests { private static final String PATH = XmlEmbeddedWebApplicationContextTests.class - .getPackage().getName().replace(".", "/") - + "/"; + .getPackage().getName().replace(".", "/") + "/"; private static final String FILE = "exampleEmbeddedWebApplicationConfiguration.xml"; @@ -40,8 +39,8 @@ public class XmlEmbeddedWebApplicationContextTests { @Test public void createFromResource() throws Exception { - this.context = new XmlEmbeddedWebApplicationContext(new ClassPathResource(FILE, - getClass())); + this.context = new XmlEmbeddedWebApplicationContext( + new ClassPathResource(FILE, getClass())); verifyContext(); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java index 4429641b1cc..364e75c5d30 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java @@ -60,8 +60,8 @@ import static org.mockito.Mockito.mock; * @author Dave Syer * @author Andy Wilkinson */ -public class JettyEmbeddedServletContainerFactoryTests extends - AbstractEmbeddedServletContainerFactoryTests { +public class JettyEmbeddedServletContainerFactoryTests + extends AbstractEmbeddedServletContainerFactoryTests { @Override protected JettyEmbeddedServletContainerFactory getFactory() { @@ -137,11 +137,12 @@ public class JettyEmbeddedServletContainerFactoryTests extends equalTo(new String[] { "ALPHA", "BRAVO", "CHARLIE" })); } - private void assertTimeout(JettyEmbeddedServletContainerFactory factory, int expected) { + private void assertTimeout(JettyEmbeddedServletContainerFactory factory, + int expected) { this.container = factory.getEmbeddedServletContainer(); JettyEmbeddedServletContainer jettyContainer = (JettyEmbeddedServletContainer) this.container; - Handler[] handlers = jettyContainer.getServer().getChildHandlersByClass( - WebAppContext.class); + Handler[] handlers = jettyContainer.getServer() + .getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) handlers[0]; int actual = webAppContext.getSessionHandler().getSessionManager() .getMaxInactiveInterval(); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java index 140e4f3ceaa..b7d79f0230c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java @@ -45,8 +45,8 @@ import static org.mockito.Mockito.mock; * @author Ivan Sopov * @author Andy Wilkinson */ -public class UndertowEmbeddedServletContainerFactoryTests extends - AbstractEmbeddedServletContainerFactoryTests { +public class UndertowEmbeddedServletContainerFactoryTests + extends AbstractEmbeddedServletContainerFactoryTests { @Override protected UndertowEmbeddedServletContainerFactory getFactory() { @@ -57,8 +57,8 @@ public class UndertowEmbeddedServletContainerFactoryTests extends public void errorPage404() throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/hello")); - this.container = factory.getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean(new ExampleServlet(), "/hello")); this.container.start(); assertThat(getResponse(getLocalUrl("/hello")), equalTo("Hello World")); assertThat(getResponse(getLocalUrl("/not-found")), equalTo("Hello World")); @@ -119,8 +119,8 @@ public class UndertowEmbeddedServletContainerFactoryTests extends for (int i = 0; i < customizers.length; i++) { customizers[i] = mock(UndertowDeploymentInfoCustomizer.class); } - factory.setDeploymentInfoCustomizers(Arrays - .asList(customizers[0], customizers[1])); + factory.setDeploymentInfoCustomizers( + Arrays.asList(customizers[0], customizers[1])); factory.addDeploymentInfoCustomizers(customizers[2], customizers[3]); this.container = factory.getEmbeddedServletContainer(); InOrder ordered = inOrder((Object[]) customizers); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java index 647a2a760dc..dde343fb6eb 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java @@ -236,8 +236,9 @@ public class ConfigurationPropertiesBindingPostProcessorTests { EnvironmentTestUtils.addEnvironment(this.context, "fooValue:bar"); this.context.register(UnmergedCustomConfigurationLocation.class); this.context.refresh(); - assertThat(this.context.getBean(UnmergedCustomConfigurationLocation.class) - .getFoo(), equalTo("${fooValue}")); + assertThat( + this.context.getBean(UnmergedCustomConfigurationLocation.class).getFoo(), + equalTo("${fooValue}")); } @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 b86e5daf440..818e19e1096 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 @@ -148,8 +148,8 @@ public class EnableConfigurationPropertiesTests { this.context.register(IgnoreNestedTestConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "name:foo", "nested.name:bar"); this.context.refresh(); - assertEquals(1, - this.context.getBeanNamesForType(IgnoreNestedTestProperties.class).length); + assertEquals(1, this.context + .getBeanNamesForType(IgnoreNestedTestProperties.class).length); assertEquals("foo", this.context.getBean(TestProperties.class).name); } @@ -166,10 +166,8 @@ public class EnableConfigurationPropertiesTests { this.context.register(NoExceptionIfInvalidTestConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "name:foo"); this.context.refresh(); - assertEquals( - 1, - this.context - .getBeanNamesForType(NoExceptionIfInvalidTestProperties.class).length); + assertEquals(1, this.context + .getBeanNamesForType(NoExceptionIfInvalidTestProperties.class).length); assertEquals("foo", this.context.getBean(TestProperties.class).name); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterIntegrationTests.java b/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterIntegrationTests.java index 1034d9a130d..35af7d630fc 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterIntegrationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterIntegrationTests.java @@ -92,8 +92,8 @@ public class ErrorPageFilterIntegrationTests { String resourcePath, HttpStatus status) throws Exception { int port = context.getEmbeddedServletContainer().getPort(); TestRestTemplate template = new TestRestTemplate(); - ResponseEntity<String> entity = template.getForEntity(new URI("http://localhost:" - + port + resourcePath), String.class); + ResponseEntity<String> entity = template.getForEntity( + new URI("http://localhost:" + port + resourcePath), String.class); assertThat(entity.getBody(), equalTo("Hello World")); assertThat(entity.getStatusCode(), equalTo(status)); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterTests.java b/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterTests.java index 393889fa5e3..67e43bc0f8f 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterTests.java @@ -97,9 +97,8 @@ public class ErrorPageFilterTests { this.filter.doFilter(this.request, this.response, this.chain); assertThat(((HttpServletResponse) this.chain.getResponse()).getStatus(), equalTo(201)); - assertThat( - ((HttpServletResponse) ((HttpServletResponseWrapper) this.chain.getResponse()) - .getResponse()).getStatus(), equalTo(201)); + assertThat(((HttpServletResponse) ((HttpServletResponseWrapper) this.chain + .getResponse()).getResponse()).getStatus(), equalTo(201)); assertTrue(this.response.isCommitted()); } @@ -364,7 +363,8 @@ public class ErrorPageFilterTests { } @Test - public void responseIsCommitedWhenRequestIsAsyncAndStatusIs400Plus() throws Exception { + public void responseIsCommitedWhenRequestIsAsyncAndStatusIs400Plus() + throws Exception { this.filter.addErrorPages(new ErrorPage("/error")); this.request.setAsyncStarted(true); this.chain = new MockFilterChain() { @@ -443,8 +443,8 @@ public class ErrorPageFilterTests { } @Test - public void errorMessageForRequestWithoutPathInfo() throws IOException, - ServletException { + public void errorMessageForRequestWithoutPathInfo() + throws IOException, ServletException { this.request.setServletPath("/test"); this.filter.addErrorPages(new ErrorPage("/error")); this.chain = new MockFilterChain() { @@ -460,7 +460,8 @@ public class ErrorPageFilterTests { } @Test - public void errorMessageForRequestWithPathInfo() throws IOException, ServletException { + public void errorMessageForRequestWithPathInfo() + throws IOException, ServletException { this.request.setServletPath("/test"); this.request.setPathInfo("/alpha"); this.filter.addErrorPages(new ErrorPage("/error")); @@ -507,8 +508,8 @@ public class ErrorPageFilterTests { this.request.setAsyncStarted(true); DeferredResult<String> result = new DeferredResult<String>(); WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.request); - asyncManager.setAsyncWebRequest(new StandardServletAsyncWebRequest(this.request, - this.response)); + asyncManager.setAsyncWebRequest( + new StandardServletAsyncWebRequest(this.request, this.response)); asyncManager.startDeferredResultProcessing(result); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/web/SpringBootServletInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/web/SpringBootServletInitializerTests.java index c5d2abfa26f..b40e7c8caba 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/web/SpringBootServletInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/web/SpringBootServletInitializerTests.java @@ -140,15 +140,16 @@ public class SpringBootServletInitializerTests { public class WithConfiguredSource extends MockSpringBootServletInitializer { @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + protected SpringApplicationBuilder configure( + SpringApplicationBuilder application) { return application.sources(Config.class); } } @Configuration - public class WithErrorPageFilterNotRegistered extends - MockSpringBootServletInitializer { + public class WithErrorPageFilterNotRegistered + extends MockSpringBootServletInitializer { public WithErrorPageFilterNotRegistered() { setRegisterErrorPageFilter(false); diff --git a/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java index 2f0287c1102..10a502dfb50 100644 --- a/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java @@ -34,8 +34,8 @@ public class PropertiesPropertySourceLoaderTests { @Test public void getFileExtensions() throws Exception { - assertThat(this.loader.getFileExtensions(), equalTo(new String[] { "properties", - "xml" })); + assertThat(this.loader.getFileExtensions(), + equalTo(new String[] { "properties", "xml" })); } @Test @@ -47,8 +47,8 @@ public class PropertiesPropertySourceLoaderTests { @Test public void loadXml() throws Exception { - PropertySource<?> source = this.loader.load("test.xml", new ClassPathResource( - "test-xml.xml", getClass()), null); + PropertySource<?> source = this.loader.load("test.xml", + new ClassPathResource("test-xml.xml", getClass()), null); assertThat(source.getProperty("test"), equalTo((Object) "xml")); } diff --git a/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java index d8af41fefcb..30552cb6366 100644 --- a/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java @@ -42,7 +42,8 @@ public class YamlPropertySourceLoaderTests { @Test public void load() throws Exception { - ByteArrayResource resource = new ByteArrayResource("foo:\n bar: spam".getBytes()); + ByteArrayResource resource = new ByteArrayResource( + "foo:\n bar: spam".getBytes()); PropertySource<?> source = this.loader.load("resource", resource, null); assertNotNull(source); assertEquals("spam", source.getProperty("foo.bar")); diff --git a/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java b/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java index dba5286b2f7..7c72d122474 100644 --- a/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java @@ -81,8 +81,8 @@ public abstract class AbstractJsonParserTests { @SuppressWarnings("unchecked") @Test public void testMapOfLists() { - Map<String, Object> map = this.parser - .parseMap("{\"foo\":[{\"foo\":\"bar\",\"spam\":1},{\"foo\":\"baz\",\"spam\":2}]}"); + Map<String, Object> map = this.parser.parseMap( + "{\"foo\":[{\"foo\":\"bar\",\"spam\":1},{\"foo\":\"baz\",\"spam\":2}]}"); assertEquals(1, map.size()); assertEquals(2, ((List<Object>) map.get("foo")).size()); } diff --git a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java index 61c35b15b2d..a6325b2d0ca 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java @@ -35,7 +35,8 @@ public class AtomikosConnectionFactoryBeanTests { @Test public void beanMethods() throws Exception { - MockAtomikosConnectionFactoryBean bean = spy(new MockAtomikosConnectionFactoryBean()); + MockAtomikosConnectionFactoryBean bean = spy( + new MockAtomikosConnectionFactoryBean()); bean.setBeanName("bean"); bean.afterPropertiesSet(); assertThat(bean.getUniqueResourceName(), equalTo("bean")); @@ -46,8 +47,8 @@ public class AtomikosConnectionFactoryBeanTests { } @SuppressWarnings("serial") - private static class MockAtomikosConnectionFactoryBean extends - AtomikosConnectionFactoryBean { + private static class MockAtomikosConnectionFactoryBean + extends AtomikosConnectionFactoryBean { @Override public synchronized void init() throws JMSException { diff --git a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java index 485f46d9539..750f0b0e30e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java @@ -61,8 +61,8 @@ public class AtomikosDependsOnBeanFactoryPostProcessorTests { assertTrue("No dependsOn expected for " + bean, expected.length == 0); return; } - HashSet<String> dependsOn = new HashSet<String>(Arrays.asList(definition - .getDependsOn())); + HashSet<String> dependsOn = new HashSet<String>( + Arrays.asList(definition.getDependsOn())); assertThat(dependsOn, equalTo(new HashSet<String>(Arrays.asList(expected)))); } diff --git a/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java b/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java index 8add298a7e0..5f0b3deee98 100644 --- a/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java @@ -143,7 +143,8 @@ public class CommonsLoggingLiquibaseLoggerTests { verify(this.delegate, never()).error("severe"); } - private class MockCommonsLoggingLiquibaseLogger extends CommonsLoggingLiquibaseLogger { + private class MockCommonsLoggingLiquibaseLogger + extends CommonsLoggingLiquibaseLogger { @Override protected Log createLogger(String name) { diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java index bb52c7a2dff..cd9add00012 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java @@ -82,7 +82,8 @@ public class LogFileTests { Map<String, Object> properties = new LinkedHashMap<String, Object>(); properties.put("logging.file", file); properties.put("logging.path", path); - PropertySource<?> propertySource = new MapPropertySource("properties", properties); + PropertySource<?> propertySource = new MapPropertySource("properties", + properties); MutablePropertySources propertySources = new MutablePropertySources(); propertySources.addFirst(propertySource); return new PropertySourcesPropertyResolver(propertySources); diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java index dea4598bebb..6dc0b9c13db 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java @@ -78,8 +78,8 @@ public class LoggingApplicationListenerTests { public void init() throws SecurityException, IOException { LogManager.getLogManager().readConfiguration( JavaLoggingSystem.class.getResourceAsStream("logging.properties")); - this.initializer.onApplicationEvent(new ApplicationStartedEvent( - new SpringApplication(), NO_ARGS)); + this.initializer.onApplicationEvent( + new ApplicationStartedEvent(new SpringApplication(), NO_ARGS)); new File("target/foo.log").delete(); new File(tmpDir() + "/spring.log").delete(); } @@ -97,8 +97,8 @@ public class LoggingApplicationListenerTests { } private String tmpDir() { - String path = this.context.getEnvironment().resolvePlaceholders( - "${java.io.tmpdir}"); + String path = this.context.getEnvironment() + .resolvePlaceholders("${java.io.tmpdir}"); path = path.replace("\\", "/"); if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); @@ -127,7 +127,8 @@ public class LoggingApplicationListenerTests { String output = this.outputCapture.toString().trim(); assertTrue("Wrong output:\n" + output, output.contains("Hello world")); assertFalse("Wrong output:\n" + output, output.contains("???")); - assertTrue("Wrong output:\n" + output, output.startsWith("LOG_FILE_IS_UNDEFINED")); + assertTrue("Wrong output:\n" + output, + output.startsWith("LOG_FILE_IS_UNDEFINED")); assertTrue("Wrong output:\n" + output, output.endsWith("BOOTBOOT")); } @@ -203,7 +204,8 @@ public class LoggingApplicationListenerTests { Log logger = LogFactory.getLog(LoggingApplicationListenerTests.class); logger.info("Hello world"); String output = this.outputCapture.toString().trim(); - assertTrue("Wrong output:\n" + output, output.startsWith("target/foo/spring.log")); + assertTrue("Wrong output:\n" + output, + output.startsWith("target/foo/spring.log")); } @Test 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 02960d5e86b..0e051c4b4ed 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 @@ -49,8 +49,8 @@ public class Log4JLoggingSystemTests extends AbstractLoggingSystemTests { @Rule public OutputCapture output = new OutputCapture(); - private final Log4JLoggingSystem loggingSystem = new Log4JLoggingSystem(getClass() - .getClassLoader()); + private final Log4JLoggingSystem loggingSystem = new Log4JLoggingSystem( + getClass().getClassLoader()); private Log4JLogger logger; diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java index 4b8c11b8918..ded274f9d8a 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java @@ -184,8 +184,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { this.loggingSystem.availableClasses( "com.fasterxml.jackson.dataformat.yaml.YAMLParser", ObjectMapper.class.getName()); - assertThat( - this.loggingSystem.getStandardConfigLocations(), + assertThat(this.loggingSystem.getStandardConfigLocations(), is(arrayContaining("log4j2.yaml", "log4j2.yml", "log4j2.json", "log4j2.jsn", "log4j2.xml"))); } diff --git a/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityScanTests.java b/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityScanTests.java index 1d516b9eb63..eeb9f2ed5bb 100644 --- a/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityScanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityScanTests.java @@ -117,8 +117,9 @@ public class EntityScanTests { } private void assertSetPackagesToScan(String... expected) { - String[] actual = this.context.getBean( - TestLocalContainerEntityManagerFactoryBean.class).getPackagesToScan(); + String[] actual = this.context + .getBean(TestLocalContainerEntityManagerFactoryBean.class) + .getPackagesToScan(); assertThat(actual, equalTo(expected)); } @@ -177,8 +178,8 @@ public class EntityScanTests { return new BeanPostProcessor() { @Override - public Object postProcessBeforeInitialization(Object bean, String beanName) - throws BeansException { + public Object postProcessBeforeInitialization(Object bean, + String beanName) throws BeansException { return bean; } @@ -202,8 +203,8 @@ public class EntityScanTests { } - private static class TestLocalContainerEntityManagerFactoryBean extends - LocalContainerEntityManagerFactoryBean { + private static class TestLocalContainerEntityManagerFactoryBean + extends LocalContainerEntityManagerFactoryBean { private String[] packagesToScan; diff --git a/spring-boot/src/test/java/org/springframework/boot/test/AbstractConfigurationClassTests.java b/spring-boot/src/test/java/org/springframework/boot/test/AbstractConfigurationClassTests.java index 648b3ee82c6..fc0963b0e0e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/AbstractConfigurationClassTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/AbstractConfigurationClassTests.java @@ -72,8 +72,8 @@ public abstract class AbstractConfigurationClassTests { .getMetadataReader(resource); AnnotationMetadata annotationMetadata = metadataReader .getAnnotationMetadata(); - if (annotationMetadata.getAnnotationTypes().contains( - Configuration.class.getName())) { + if (annotationMetadata.getAnnotationTypes() + .contains(Configuration.class.getName())) { configurationClasses.add(annotationMetadata); } } diff --git a/spring-boot/src/test/java/org/springframework/boot/test/ApplicationContextTestUtilsTests.java b/spring-boot/src/test/java/org/springframework/boot/test/ApplicationContextTestUtilsTests.java index 3b2f22e5fcd..4a795fb8dc1 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/ApplicationContextTestUtilsTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/ApplicationContextTestUtilsTests.java @@ -45,7 +45,8 @@ public class ApplicationContextTestUtilsTests { @Test public void closeContextAndParent() { ConfigurableApplicationContext mock = mock(ConfigurableApplicationContext.class); - ConfigurableApplicationContext parent = mock(ConfigurableApplicationContext.class); + ConfigurableApplicationContext parent = mock( + ConfigurableApplicationContext.class); given(mock.getParent()).willReturn(parent); given(parent.getParent()).willReturn(null); ApplicationContextTestUtils.closeAll(mock); diff --git a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationContextLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationContextLoaderTests.java index 704c0f5a779..e85bffec5e3 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationContextLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationContextLoaderTests.java @@ -65,7 +65,8 @@ public class SpringApplicationContextLoaderTests { @Test public void environmentPropertiesAnotherSeparatorInValue() throws Exception { - Map<String, Object> config = getEnvironmentProperties(AnotherSeparatorInValue.class); + Map<String, Object> config = getEnvironmentProperties( + AnotherSeparatorInValue.class); assertKey(config, "key", "my:Value"); assertKey(config, "anotherKey", "another=Value"); } @@ -77,8 +78,8 @@ public class SpringApplicationContextLoaderTests { new IntegrationTestPropertiesListener().prepareTestInstance(context); MergedContextConfiguration config = (MergedContextConfiguration) ReflectionTestUtils .getField(context, "mergedContextConfiguration"); - return this.loader.extractEnvironmentProperties(config - .getPropertySourceProperties()); + return this.loader + .extractEnvironmentProperties(config.getPropertySourceProperties()); } private void assertKey(Map<String, Object> actual, String key, Object value) { diff --git a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java index b8a62cc5153..30b2fdd7f8e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java @@ -57,8 +57,8 @@ public class SpringApplicationIntegrationTestTests { public void runAndTestHttpEndpoint() { assertNotEquals(8080, this.port); assertNotEquals(0, this.port); - String body = new RestTemplate().getForObject("http://localhost:" + this.port - + "/", String.class); + String body = new RestTemplate() + .getForObject("http://localhost:" + this.port + "/", String.class); assertEquals("Hello World", body); } diff --git a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationWebIntegrationTestTests.java b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationWebIntegrationTestTests.java index f33c8372ffd..1adf89c55ce 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationWebIntegrationTestTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationWebIntegrationTestTests.java @@ -55,8 +55,8 @@ public class SpringApplicationWebIntegrationTestTests { public void runAndTestHttpEndpoint() { assertNotEquals(8080, this.port); assertNotEquals(0, this.port); - String body = new RestTemplate().getForObject("http://localhost:" + this.port - + "/", String.class); + String body = new RestTemplate() + .getForObject("http://localhost:" + this.port + "/", String.class); assertEquals("Hello World", body); } diff --git a/spring-boot/src/test/java/org/springframework/boot/test/TestRestTemplateTests.java b/spring-boot/src/test/java/org/springframework/boot/test/TestRestTemplateTests.java index 9726e09a15e..2c9a4fe778d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/TestRestTemplateTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/TestRestTemplateTests.java @@ -38,12 +38,14 @@ public class TestRestTemplateTests { @Test public void simple() { // The Apache client is on the classpath so we get the fully-leaded factory - assertTrue(new TestRestTemplate().getRequestFactory() instanceof HttpComponentsClientHttpRequestFactory); + assertTrue(new TestRestTemplate() + .getRequestFactory() instanceof HttpComponentsClientHttpRequestFactory); } @Test public void authenticated() { - assertTrue(new TestRestTemplate("user", "password").getRequestFactory() instanceof InterceptingClientHttpRequestFactory); + assertTrue(new TestRestTemplate("user", "password") + .getRequestFactory() instanceof InterceptingClientHttpRequestFactory); } @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxViewTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxViewTests.java index 73ff4948f81..eefef65e66c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxViewTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxViewTests.java @@ -43,8 +43,8 @@ import static org.junit.Assert.assertThat; */ public class EmbeddedVelocityToolboxViewTests { - private static final String PATH = EmbeddedVelocityToolboxViewTests.class - .getPackage().getName().replace(".", "/"); + private static final String PATH = EmbeddedVelocityToolboxViewTests.class.getPackage() + .getName().replace(".", "/"); @Test public void loadsContextFromClassPath() throws Exception { @@ -69,8 +69,8 @@ public class EmbeddedVelocityToolboxViewTests { Map<String, Object> model = new LinkedHashMap<String, Object>(); HttpServletRequest request = new MockHttpServletRequest(); HttpServletResponse response = new MockHttpServletResponse(); - ToolContext toolContext = (ToolContext) view.createVelocityContext(model, - request, response); + ToolContext toolContext = (ToolContext) view.createVelocityContext(model, request, + response); context.close(); return toolContext; } diff --git a/spring-boot/src/test/java/org/springframework/boot/yaml/ArrayDocumentMatcherTests.java b/spring-boot/src/test/java/org/springframework/boot/yaml/ArrayDocumentMatcherTests.java index bbcf93b7baf..777f2747ebd 100644 --- a/spring-boot/src/test/java/org/springframework/boot/yaml/ArrayDocumentMatcherTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/yaml/ArrayDocumentMatcherTests.java @@ -53,8 +53,8 @@ public class ArrayDocumentMatcherTests { } private Properties getProperties(String values) throws IOException { - return PropertiesLoaderUtils.loadProperties(new ByteArrayResource(values - .getBytes())); + return PropertiesLoaderUtils + .loadProperties(new ByteArrayResource(values.getBytes())); } }