diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java index d1f42286e68..010ee7dc458 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java @@ -150,37 +150,42 @@ public class ManagementWebSecurityAutoConfiguration { @Override public void init(WebSecurity builder) throws Exception { - if (this.server != null) { - IgnoredRequestConfigurer ignoring = builder.ignoring(); - // The ignores are not cumulative, so to prevent overwriting the defaults - // we add them back. - Set ignored = new LinkedHashSet( - SpringBootWebSecurityConfiguration.getIgnored(this.security)); - if (ignored.contains("none")) { - ignored.remove("none"); - } - if (this.errorController != null) { - ignored.add(normalizePath(this.errorController.getErrorPath())); - } - String[] paths = this.server.getPathsArray(ignored); - RequestMatcher requestMatcher = this.management.getSecurity().isEnabled() - ? null - : LazyEndpointPathRequestMatcher - .getRequestMatcher(this.contextResolver); - if (!ObjectUtils.isEmpty(paths)) { - List matchers = new ArrayList(); - for (String pattern : paths) { - matchers.add(new AntPathRequestMatcher(pattern, null)); - } - if (requestMatcher != null) { - matchers.add(requestMatcher); - } - requestMatcher = new OrRequestMatcher(matchers); + if (this.server == null) { + return; + } + IgnoredRequestConfigurer ignoring = builder.ignoring(); + // The ignores are not cumulative, so to prevent overwriting the defaults + // we add them back. + Set ignored = new LinkedHashSet( + SpringBootWebSecurityConfiguration.getIgnored(this.security)); + if (ignored.contains("none")) { + ignored.remove("none"); + } + if (this.errorController != null) { + ignored.add(normalizePath(this.errorController.getErrorPath())); + } + RequestMatcher requestMatcher = getRequestMatcher(); + String[] paths = this.server.getPathsArray(ignored); + if (!ObjectUtils.isEmpty(paths)) { + List matchers = new ArrayList(); + for (String pattern : paths) { + matchers.add(new AntPathRequestMatcher(pattern, null)); } if (requestMatcher != null) { - ignoring.requestMatchers(requestMatcher); + matchers.add(requestMatcher); } + requestMatcher = new OrRequestMatcher(matchers); } + if (requestMatcher != null) { + ignoring.requestMatchers(requestMatcher); + } + } + + private RequestMatcher getRequestMatcher() { + if (this.management.getSecurity().isEnabled()) { + return null; + } + return LazyEndpointPathRequestMatcher.getRequestMatcher(this.contextResolver); } private String normalizePath(String errorPath) { @@ -239,10 +244,7 @@ public class ManagementWebSecurityAutoConfiguration { @Override protected void configure(HttpSecurity http) throws Exception { // secure endpoints - RequestMatcher matcher = this.management.getSecurity().isEnabled() - ? LazyEndpointPathRequestMatcher - .getRequestMatcher(this.contextResolver) - : null; + RequestMatcher matcher = getRequestMatcher(); if (matcher != null) { // Always protect them if present if (this.security.isRequireSsl()) { @@ -264,6 +266,14 @@ public class ManagementWebSecurityAutoConfiguration { } } + private RequestMatcher getRequestMatcher() { + if (this.management.getSecurity().isEnabled()) { + return LazyEndpointPathRequestMatcher + .getRequestMatcher(this.contextResolver); + } + return null; + } + private AuthenticationEntryPoint entryPoint() { BasicAuthenticationEntryPoint entryPoint = new BasicAuthenticationEntryPoint(); entryPoint.setRealmName(this.security.getBasic().getRealm()); 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 db7fccfed35..6b09d57fba7 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 @@ -65,15 +65,24 @@ 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())); + Runtime runtime = Runtime.getRuntime(); + result.add(newMemoryMetric("mem", + runtime.totalMemory() + getTotalNonHeapMemoryIfPossible())); + result.add(newMemoryMetric("mem.free", runtime.freeMemory())); + result.add(new Metric("processors", runtime.availableProcessors())); result.add(new Metric("instance.uptime", System.currentTimeMillis() - this.timestamp)); } + private long getTotalNonHeapMemoryIfPossible() { + try { + return ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getUsed(); + } + catch (Throwable ex) { + return 0; + } + } + /** * Add metrics from ManagementFactory if possible. Note that ManagementFactory is not * available on Google App Engine. @@ -87,6 +96,7 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { result.add(new Metric("systemload.average", ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage())); addHeapMetrics(result); + addNonHeapMetrics(result); addThreadMetrics(result); addClassLoadingMetrics(result); addGarbageCollectionMetrics(result); @@ -103,31 +113,27 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { protected void addHeapMetrics(Collection> result) { MemoryUsage memoryUsage = ManagementFactory.getMemoryMXBean() .getHeapMemoryUsage(); - result.add(new Metric("heap.committed", memoryUsage.getCommitted() / 1024)); - result.add(new Metric("heap.init", memoryUsage.getInit() / 1024)); - result.add(new Metric("heap.used", memoryUsage.getUsed() / 1024)); - result.add(new Metric("heap", memoryUsage.getMax() / 1024)); - memoryUsage = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage(); - result.add( - new Metric("nonheap.committed", memoryUsage.getCommitted() / 1024)); - result.add(new Metric("nonheap.init", memoryUsage.getInit() / 1024)); - result.add(new Metric("nonheap.used", memoryUsage.getUsed() / 1024)); - result.add(new Metric("nonheap", memoryUsage.getMax() / 1024)); - Metric mem = findMemory(result); - if (mem != null) { - mem.increment(new Long(memoryUsage.getUsed() / 1024).intValue()); - } + result.add(newMemoryMetric("heap.committed", memoryUsage.getCommitted())); + result.add(newMemoryMetric("heap.init", memoryUsage.getInit())); + result.add(newMemoryMetric("heap.used", memoryUsage.getUsed())); + result.add(newMemoryMetric("heap", memoryUsage.getMax())); } - private Metric findMemory(Collection> result) { - for (Metric metric : result) { - if ("mem".equals(metric.getName())) { - @SuppressWarnings("unchecked") - Metric value = (Metric) metric; - return value; - } - } - return null; + /** + * Add JVM non-heap metrics. + * @param result the result + */ + private void addNonHeapMetrics(Collection> result) { + MemoryUsage memoryUsage = ManagementFactory.getMemoryMXBean() + .getNonHeapMemoryUsage(); + result.add(newMemoryMetric("nonheap.committed", memoryUsage.getCommitted())); + result.add(newMemoryMetric("nonheap.init", memoryUsage.getInit())); + result.add(newMemoryMetric("nonheap.used", memoryUsage.getUsed())); + result.add(newMemoryMetric("nonheap", memoryUsage.getMax())); + } + + private Metric newMemoryMetric(String name, long bytes) { + return new Metric(name, bytes / 1024); } /** diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointBrowserPathIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointBrowserPathIntegrationTests.java index c5ce3a2e72c..20999c0e539 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointBrowserPathIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointBrowserPathIntegrationTests.java @@ -41,8 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; /** - * Integration tests for {@link HalBrowserMvcEndpoint}'s support for producing - * text/html + * Integration tests for {@link HalBrowserMvcEndpoint}'s support for producing text/html * * @author Dave Syer * @author Andy Wilkinson diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointManagementContextPathIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointManagementContextPathIntegrationTests.java index f1978d945b0..b6436ef5c9c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointManagementContextPathIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointManagementContextPathIntegrationTests.java @@ -44,8 +44,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; /** - * Integration tests for {@link HalBrowserMvcEndpoint} when a custom management - * context path has been configured. + * Integration tests for {@link HalBrowserMvcEndpoint} when a custom management context + * path has been configured. * * @author Dave Syer * @author Andy Wilkinson diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerContextPathIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerContextPathIntegrationTests.java index c3ae83c86ab..8ad3a60c7d3 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerContextPathIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerContextPathIntegrationTests.java @@ -45,8 +45,8 @@ import static org.junit.Assert.assertTrue; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; /** - * Integration tests for {@link HalBrowserMvcEndpoint} when a custom server context - * path has been configured. + * Integration tests for {@link HalBrowserMvcEndpoint} when a custom server context path + * has been configured. * * @author Dave Syer * @author Andy Wilkinson diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerPortIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerPortIntegrationTests.java index 3a30063c713..495cfc21927 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerPortIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerPortIntegrationTests.java @@ -45,8 +45,8 @@ import static org.junit.Assert.assertTrue; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; /** - * Integration tests for {@link HalBrowserMvcEndpoint} when a custom server port has - * been configured. + * Integration tests for {@link HalBrowserMvcEndpoint} when a custom server port has been + * configured. * * @author Dave Syer * @author Andy Wilkinson 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 c93810b1896..d19a733080d 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 @@ -50,12 +50,14 @@ public abstract class SpringBootCondition implements Condition { return outcome.isMatch(); } catch (NoClassDefFoundError ex) { - throw new IllegalStateException("Could not evaluate condition on " - + classOrMethodName + " due to " + ex.getMessage() + " not " - + "found. Make sure your own configuration does not rely on " - + "that class. This can also happen if you are " - + "@ComponentScanning a springframework package (e.g. if you " - + "put a @ComponentScan in the default package by mistake)", ex); + throw new IllegalStateException( + "Could not evaluate condition on " + classOrMethodName + " due to " + + ex.getMessage() + " not " + + "found. Make sure your own configuration does not rely on " + + "that class. This can also happen if you are " + + "@ComponentScanning a springframework package (e.g. if you " + + "put a @ComponentScan in the default package by mistake)", + ex); } catch (RuntimeException ex) { throw new IllegalStateException( diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcp2DataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcp2DataSourcePoolMetadata.java index 390441c3436..ff33a0c4abd 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcp2DataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcp2DataSourcePoolMetadata.java @@ -54,4 +54,3 @@ public class CommonsDbcp2DataSourcePoolMetadata } } - diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java index 99525fce1ec..4215f741267 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java @@ -78,6 +78,11 @@ import org.springframework.util.Assert; @ConditionalOnClass({ Mongo.class, MongodStarter.class }) public class EmbeddedMongoAutoConfiguration { + private static final byte[] IP4_LOOPBACK_ADDRESS = { 127, 0, 0, 1 }; + + private static final byte[] IP6_LOOPBACK_ADDRESS = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1 }; + @Autowired private MongoProperties properties; @@ -158,8 +163,7 @@ public class EmbeddedMongoAutoConfiguration { private InetAddress getHost() throws UnknownHostException { if (this.properties.getHost() == null) { return InetAddress.getByAddress(Network.localhostIsIPv6() - ? new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } - : new byte[] { 127, 0, 0, 1 }); + ? IP6_LOOPBACK_ADDRESS : IP4_LOOPBACK_ADDRESS); } return InetAddress.getByName(this.properties.getHost()); } 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 8e0c4306b0b..c35491e9cb5 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 @@ -204,7 +204,8 @@ public class FlywayAutoConfigurationTests { FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); Flyway flyway = this.context.getBean(Flyway.class); - assertThat(flyway.getBaselineVersion(), equalTo(MigrationVersion.fromVersion("0"))); + assertThat(flyway.getBaselineVersion(), + equalTo(MigrationVersion.fromVersion("0"))); } private void registerAndRefresh(Class... annotatedClasses) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java index 5b70be10201..c90df3a7895 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java @@ -146,8 +146,7 @@ public class OAuth2AutoConfigurationTests { "security.oauth2.client.clientSecret:mysecret", "security.oauth2.client.autoApproveScopes:read,write", "security.oauth2.client.accessTokenValiditySeconds:40", - "security.oauth2.client.refreshTokenValiditySeconds:80" - ); + "security.oauth2.client.refreshTokenValiditySeconds:80"); this.context.register(AuthorizationAndResourceServerConfiguration.class, MinimalSecureWebApplication.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java index 48fbfd8cb8e..a0ca7002dd5 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java @@ -277,6 +277,7 @@ public class ResourceServerTokenServicesConfigurationTests { ClientHttpRequestExecution execution) throws IOException { return execution.execute(request, body); } + }); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/DefaultCommandFactory.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/DefaultCommandFactory.java index b809c9d56ec..9e7b7104fd8 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/DefaultCommandFactory.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/DefaultCommandFactory.java @@ -41,8 +41,8 @@ public class DefaultCommandFactory implements CommandFactory { private static final List DEFAULT_COMMANDS = Arrays.asList( new VersionCommand(), new RunCommand(), new TestCommand(), new GrabCommand(), - new JarCommand(), new WarCommand(), new InstallCommand(), new UninstallCommand(), - new InitCommand()); + new JarCommand(), new WarCommand(), new InstallCommand(), + new UninstallCommand(), new InitCommand()); @Override public Collection getCommands() { diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerTests.java index c003f6635ab..f4334573d1b 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerTests.java @@ -44,7 +44,8 @@ public class SpringApplicationRunnerTests { given(configuration.getLogLevel()).willReturn(Level.INFO); this.thrown.expect(RuntimeException.class); this.thrown.expectMessage(equalTo("No classes found in '[foo, bar]'")); - new SpringApplicationRunner(configuration, new String[] { "foo", "bar" }).compileAndRun(); + new SpringApplicationRunner(configuration, new String[] { "foo", "bar" }) + .compileAndRun(); } } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RestartCompatibleRedisSerializerConfigurer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RestartCompatibleRedisSerializerConfigurer.java index 7640a0c2781..c45172f7b16 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RestartCompatibleRedisSerializerConfigurer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RestartCompatibleRedisSerializerConfigurer.java @@ -35,7 +35,6 @@ import org.springframework.util.ObjectUtils; * * @author Andy Wilkinson * @author Rob Winch - * * @see RedisTemplate#setHashKeySerializer(RedisSerializer) * @see RedisTemplate#setHashValueSerializer(RedisSerializer) * @see RedisTemplate#setKeySerializer(RedisSerializer) @@ -69,6 +68,8 @@ class RestartCompatibleRedisSerializerConfigurer implements BeanClassLoaderAware static class RestartCompatibleRedisSerializer implements RedisSerializer { + private static final byte[] NO_BYTES = new byte[0]; + private final Converter serializer = new SerializingConverter(); private final Converter deserializer; @@ -80,12 +81,9 @@ class RestartCompatibleRedisSerializerConfigurer implements BeanClassLoaderAware @Override public Object deserialize(byte[] bytes) { - if (ObjectUtils.isEmpty(bytes)) { - return null; - } - try { - return this.deserializer.convert(bytes); + return (ObjectUtils.isEmpty(bytes) ? null + : this.deserializer.convert(bytes)); } catch (Exception ex) { throw new SerializationException("Cannot deserialize", ex); @@ -94,11 +92,8 @@ class RestartCompatibleRedisSerializerConfigurer implements BeanClassLoaderAware @Override public byte[] serialize(Object object) { - if (object == null) { - return new byte[0]; - } try { - return this.serializer.convert(object); + return (object == null ? NO_BYTES : this.serializer.convert(object)); } catch (Exception ex) { throw new SerializationException("Cannot serialize", ex); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilter.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilter.java index 24549a20b98..cad1b4d5da8 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilter.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilter.java @@ -41,10 +41,9 @@ public class DefaultSourceFolderUrlFilter implements SourceFolderUrlFilter { private static final Pattern VERSION_PATTERN = Pattern .compile("^-\\d+(?:\\.\\d+)*(?:[.-].+)?$"); - private static final Set SKIPPED_PROJECTS = new HashSet( - Arrays.asList("spring-boot", "spring-boot-devtools", - "spring-boot-autoconfigure", "spring-boot-actuator", - "spring-boot-starter")); + private static final Set SKIPPED_PROJECTS = new HashSet(Arrays.asList( + "spring-boot", "spring-boot-devtools", "spring-boot-autoconfigure", + "spring-boot-actuator", "spring-boot-starter")); @Override public boolean isMatch(String sourceFolder, URL url) { diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 77ec21b2bd7..d3c86f0bfd4 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -4026,6 +4026,7 @@ same semantic as the regular `@Order` annotation but provides a dedicated order auto-configuration classes. + [[boot-features-condition-annotations]] === Condition annotations You almost always want to include one or more `@Conditional` annotations on your diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementPortAndPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementPortAndPathSampleActuatorApplicationTests.java index 0802952a56e..97d9574ad94 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementPortAndPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementPortAndPathSampleActuatorApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java index 57e01a13508..1446de329a3 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot/src/main/java/org/springframework/boot/ApplicationHome.java b/spring-boot/src/main/java/org/springframework/boot/ApplicationHome.java index a17494e2066..7c54dbb2a7f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ApplicationHome.java +++ b/spring-boot/src/main/java/org/springframework/boot/ApplicationHome.java @@ -95,8 +95,9 @@ public class ApplicationHome { } /** - * Returns the underlying source used to find the home directory. This is usually the jar - * file or a directory. Can return {@code null} if the source cannot be determined. + * Returns the underlying source used to find the home directory. This is usually the + * jar file or a directory. Can return {@code null} if the source cannot be + * determined. * @return the underlying source or {@code null} */ public File getSource() { diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 56645e8433e..bfac555a657 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -520,9 +520,7 @@ public class SpringApplication { * @see #setBannerMode */ protected void printBanner(Environment environment) { - Banner selectedBanner = selectBanner(environment); - if (this.bannerMode == Banner.Mode.LOG) { try { this.log.info(createStringFromBanner(selectedBanner, environment)); @@ -542,7 +540,6 @@ public class SpringApplication { ResourceLoader resourceLoader = this.resourceLoader != null ? this.resourceLoader : new DefaultResourceLoader(getClassLoader()); Resource resource = resourceLoader.getResource(location); - if (resource.exists()) { return new ResourceBanner(resource); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ConfigurableEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ConfigurableEmbeddedServletContainer.java index c8b278c9ac1..4421243c9f9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ConfigurableEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ConfigurableEmbeddedServletContainer.java @@ -144,8 +144,8 @@ public interface ConfigurableEmbeddedServletContainer { void setMimeMappings(MimeMappings mimeMappings); /** - * Sets the document root directory which will be used by the web context to serve static - * files. + * Sets the document root directory which will be used by the web context to serve + * static files. * @param documentRoot the document root or {@code null} if not required */ void setDocumentRoot(File documentRoot); diff --git a/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java index ffae9a6f25a..cea6ffb64cf 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java @@ -39,10 +39,9 @@ import org.springframework.web.context.support.StandardServletEnvironment; /** * An {@link EnvironmentPostProcessor} that parses JSON from - * {@code spring.application.json} or equivalently - * {@code SPRING_APPLICATION_JSON} and adds it as a map property - * source to the {@link Environment}. The new properties are added with higher priority - * than the system properties. + * {@code spring.application.json} or equivalently {@code SPRING_APPLICATION_JSON} and + * adds it as a map property source to the {@link Environment}. The new properties are + * added with higher priority than the system properties. * * @author Dave Syer * @author Phillip Webb 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 e00332b1277..c193ecbb550 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 @@ -106,9 +106,9 @@ public class AtomikosProperties { /** * Specifies if subtransactions should be joined when possible. Defaults to true. When * false, no attempt to call {@code XAResource.start(TM_JOIN)} will be made for - * different but related subtransactions. This setting has no effect on resource access - * within one and the same transaction. If you don't use subtransactions then this - * setting can be ignored. + * different but related subtransactions. This setting has no effect on resource + * access within one and the same transaction. If you don't use subtransactions then + * this setting can be ignored. * @param serialJtaTransactions if serial JTA transaction are supported */ public void setSerialJtaTransactions(boolean serialJtaTransactions) { diff --git a/spring-boot/src/main/java/org/springframework/boot/test/SpringBootMockServletContext.java b/spring-boot/src/main/java/org/springframework/boot/test/SpringBootMockServletContext.java index 7bf2b407b2c..75f81c3f64f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/SpringBootMockServletContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/SpringBootMockServletContext.java @@ -28,7 +28,8 @@ import org.springframework.mock.web.MockServletContext; /** * {@link MockServletContext} implementation for Spring Boot. Respects well know Spring - * Boot resource locations and uses an empty directory for "/" if no locations can be found. + * Boot resource locations and uses an empty directory for "/" if no locations can be + * found. * * @author Phillip Webb */ 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 77cac6dba47..e1837197d36 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 @@ -82,8 +82,8 @@ public class SpringApplicationIntegrationTestTests { @Test public void validateWebApplicationContextIsSet() { - assertSame(this.context, WebApplicationContextUtils - .getWebApplicationContext(this.servletContext)); + assertSame(this.context, + WebApplicationContextUtils.getWebApplicationContext(this.servletContext)); } @Configuration diff --git a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationMockMvcTests.java b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationMockMvcTests.java index 141229c63f8..1abd57a1837 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationMockMvcTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationMockMvcTests.java @@ -71,11 +71,10 @@ public class SpringApplicationMockMvcTests { @Test public void validateWebApplicationContextIsSet() { - assertSame(this.context, WebApplicationContextUtils - .getWebApplicationContext(this.servletContext)); + assertSame(this.context, + WebApplicationContextUtils.getWebApplicationContext(this.servletContext)); } - @Configuration @EnableWebMvc @RestController 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 964f73ea2b5..46c67d676c3 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 @@ -49,7 +49,7 @@ import static org.junit.Assert.assertSame; */ @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(Config.class) -@WebIntegrationTest({"server.port=0", "value=123"}) +@WebIntegrationTest({ "server.port=0", "value=123" }) public class SpringApplicationWebIntegrationTestTests { @Value("${local.server.port}") @@ -80,8 +80,8 @@ public class SpringApplicationWebIntegrationTestTests { @Test public void validateWebApplicationContextIsSet() { - assertSame(this.context, WebApplicationContextUtils - .getWebApplicationContext(this.servletContext)); + assertSame(this.context, + WebApplicationContextUtils.getWebApplicationContext(this.servletContext)); } @Configuration