diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java index 81145fc3027..d48e861f9ee 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java index 26b6716c562..6734ec2a737 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java index d362c87816a..cd96bd5463d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java @@ -798,8 +798,7 @@ public class KafkaProperties { /** * Control flag for login configuration. */ - private KafkaJaasLoginModuleInitializer.ControlFlag controlFlag = - KafkaJaasLoginModuleInitializer.ControlFlag.REQUIRED; + private KafkaJaasLoginModuleInitializer.ControlFlag controlFlag = KafkaJaasLoginModuleInitializer.ControlFlag.REQUIRED; /** * Additional JAAS options. @@ -826,7 +825,8 @@ public class KafkaProperties { return this.controlFlag; } - public void setControlFlag(KafkaJaasLoginModuleInitializer.ControlFlag controlFlag) { + public void setControlFlag( + KafkaJaasLoginModuleInitializer.ControlFlag controlFlag) { this.controlFlag = controlFlag; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java index f4398accce4..39e72f6fec5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java @@ -254,7 +254,7 @@ public class ThymeleafAutoConfiguration { ThymeleafReactiveViewResolver resolver = new ThymeleafReactiveViewResolver(); resolver.setTemplateEngine(templateEngine); resolver.setDefaultCharset(this.properties.getEncoding()); - final List mediaTypes = this.properties.getReactive().getMediaTypes(); + List mediaTypes = this.properties.getReactive().getMediaTypes(); if (mediaTypes != null) { resolver.setSupportedMediaTypes(mediaTypes); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfiguration.java index 647409c9bca..3f55e5b8993 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfiguration.java @@ -69,7 +69,8 @@ public class HttpHandlerAutoConfiguration { @Bean public HttpHandler httpHandler() { - return WebHttpHandlerBuilder.applicationContext(this.applicationContext).build(); + return WebHttpHandlerBuilder.applicationContext(this.applicationContext) + .build(); } } @@ -87,9 +88,9 @@ public class HttpHandlerAutoConfiguration { private final List viewResolvers; public FunctionalConfig(ObjectProvider> webFilters, - ObjectProvider webSessionManager, - ObjectProvider handlerStrategiesBuilder, - ObjectProvider> viewResolvers) { + ObjectProvider webSessionManager, + ObjectProvider handlerStrategiesBuilder, + ObjectProvider> viewResolvers) { this.webFilters = webFilters.getIfAvailable(); if (this.webFilters != null) { AnnotationAwareOrderComparator.sort(this.webFilters); @@ -103,7 +104,7 @@ public class HttpHandlerAutoConfiguration { public HttpHandler httpHandler(List> routerFunctions) { routerFunctions.sort(new AnnotationAwareOrderComparator()); RouterFunction routerFunction = routerFunctions.stream() - .reduce(RouterFunction::andOther).get(); + .reduce(RouterFunction::andOther).get(); if (this.handlerStrategiesBuilder == null) { this.handlerStrategiesBuilder = HandlerStrategies.builder(); } @@ -111,9 +112,9 @@ public class HttpHandlerAutoConfiguration { this.viewResolvers.forEach(this.handlerStrategiesBuilder::viewResolver); } WebHandler webHandler = RouterFunctions.toHttpHandler(routerFunction, - this.handlerStrategiesBuilder.build()); + this.handlerStrategiesBuilder.build()); WebHttpHandlerBuilder builder = WebHttpHandlerBuilder.webHandler(webHandler) - .sessionManager(this.webSessionManager); + .sessionManager(this.webSessionManager); builder.filters(this.webFilters); return builder.build(); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/reactive/WebSocketReactiveAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/reactive/WebSocketReactiveAutoConfiguration.java index 6231b9b7e85..c739574ba07 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/reactive/WebSocketReactiveAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/reactive/WebSocketReactiveAutoConfiguration.java @@ -31,13 +31,14 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** - * Auto configuration for WebSocket reactive server in Tomcat, Jetty or Undertow. - * Requires the appropriate WebSocket modules to be on the classpath. + * Auto configuration for WebSocket reactive server in Tomcat, Jetty or Undertow. Requires + * the appropriate WebSocket modules to be on the classpath. *

* If Tomcat's WebSocket support is detected on the classpath we add a customizer that * installs the Tomcat WebSocket initializer. * * @author Brian Clozel + * @since 2.0.0 */ @Configuration @ConditionalOnClass({ Servlet.class, ServerContainer.class }) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/TomcatWebSocketServletWebServerCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/TomcatWebSocketServletWebServerCustomizer.java index 23331ad4d36..d867b4a2068 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/TomcatWebSocketServletWebServerCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/TomcatWebSocketServletWebServerCustomizer.java @@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.websocket.servlet; import org.apache.tomcat.websocket.server.WsContextListener; -import org.springframework.boot.web.embedded.tomcat.TomcatContextCustomizer; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.core.Ordered; @@ -36,8 +35,8 @@ public class TomcatWebSocketServletWebServerCustomizer @Override public void customize(TomcatServletWebServerFactory factory) { - factory.addContextCustomizers((TomcatContextCustomizer) context -> - context.addApplicationListener(WsContextListener.class.getName())); + factory.addContextCustomizers((context) -> context + .addApplicationListener(WsContextListener.class.getName())); } @Override diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilderTests.java index a8aca1e97d8..7e29f081a3d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilderTests.java @@ -46,24 +46,23 @@ public class DataSourceBuilderTests { @Test public void defaultToHikari() { - this.dataSource = DataSourceBuilder.create() - .url("jdbc:h2:test").build(); + this.dataSource = DataSourceBuilder.create().url("jdbc:h2:test").build(); assertThat(this.dataSource).isInstanceOf(HikariDataSource.class); } @Test public void defaultToTomcatIfHikariIsNotAvailable() { - this.dataSource = DataSourceBuilder.create( - new HidePackagesClassLoader("com.zaxxer.hikari")) + this.dataSource = DataSourceBuilder + .create(new HidePackagesClassLoader("com.zaxxer.hikari")) .url("jdbc:h2:test").build(); - assertThat(this.dataSource).isInstanceOf( - org.apache.tomcat.jdbc.pool.DataSource.class); + assertThat(this.dataSource) + .isInstanceOf(org.apache.tomcat.jdbc.pool.DataSource.class); } @Test public void defaultToCommonsDbcp2AsLastResort() { - this.dataSource = DataSourceBuilder.create( - new HidePackagesClassLoader("com.zaxxer.hikari", + this.dataSource = DataSourceBuilder + .create(new HidePackagesClassLoader("com.zaxxer.hikari", "org.apache.tomcat.jdbc.pool")) .url("jdbc:h2:test").build(); assertThat(this.dataSource).isInstanceOf(BasicDataSource.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java index 104ccd2d91f..acbf66a5c33 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java @@ -176,8 +176,7 @@ public class KafkaAutoConfigurationTests { "spring.kafka.listener.ack-time=456", "spring.kafka.listener.concurrency=3", "spring.kafka.listener.poll-timeout=2000", - "spring.kafka.jaas.enabled=true", - "spring.kafka.jaas.login-module=foo", + "spring.kafka.jaas.enabled=true", "spring.kafka.jaas.login-module=foo", "spring.kafka.jaas.control-flag=REQUISITE", "spring.kafka.jaas.options.useKeyTab=true"); DefaultKafkaProducerFactory producerFactory = this.context @@ -201,8 +200,8 @@ public class KafkaAutoConfigurationTests { .isEqualTo(2000L); assertThat(this.context.getBeansOfType(KafkaJaasLoginModuleInitializer.class)) .hasSize(1); - KafkaJaasLoginModuleInitializer jaas = this.context.getBean( - KafkaJaasLoginModuleInitializer.class); + KafkaJaasLoginModuleInitializer jaas = this.context + .getBean(KafkaJaasLoginModuleInitializer.class); dfa = new DirectFieldAccessor(jaas); assertThat(dfa.getPropertyValue("loginModule")).isEqualTo("foo"); assertThat(dfa.getPropertyValue("controlFlag")) diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java index 130b22ef6dd..b0c6f25b901 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java index ce7e86592e2..3483b0471e4 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java index ec6734e4adb..58cded28494 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java index 4987e3e46db..a0a6292034e 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java index 34b478d9298..52a5cbd65ad 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/Person.java b/spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/Person.java index 4eeb005dc4f..d807323b467 100644 --- a/spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/Person.java +++ b/spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/Person.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Note.java b/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Note.java index 999dcdceb10..9e2744b4602 100644 --- a/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Note.java +++ b/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Note.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Tag.java b/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Tag.java index fb24a83e050..3182d5d25bb 100644 --- a/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Tag.java +++ b/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Tag.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java index 8146b2ec2ef..d7a6ee5e4d4 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java @@ -349,8 +349,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor } private Element getTopLevelType(Element element) { - if ((element.getEnclosingElement() == null) || - !(element.getEnclosingElement() instanceof TypeElement)) { + if ((element.getEnclosingElement() == null) + || !(element.getEnclosingElement() instanceof TypeElement)) { return element; } return getTopLevelType(element.getEnclosingElement()); 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 7793f7cd518..993cf769978 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 @@ -179,8 +179,8 @@ class TypeElementMembers { return candidate; } TypeMirror alternative = this.typeUtils.getWrapperOrPrimitiveFor(type); - if (alternative != null && - this.env.getTypeUtils().isSameType(returnType, alternative)) { + if (alternative != null + && this.env.getTypeUtils().isSameType(returnType, alternative)) { return candidate; } } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java index d7aa5296454..2d0f172df2a 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java @@ -159,14 +159,16 @@ public final class ItemMetadata implements Comparable { return false; } ItemMetadata other = (ItemMetadata) o; - return nullSafeEquals(this.itemType, other.itemType) - && nullSafeEquals(this.name, other.name) - && nullSafeEquals(this.type, other.type) - && nullSafeEquals(this.description, other.description) - && nullSafeEquals(this.sourceType, other.sourceType) - && nullSafeEquals(this.sourceMethod, other.sourceMethod) - && nullSafeEquals(this.defaultValue, other.defaultValue) - && nullSafeEquals(this.deprecation, other.deprecation); + boolean result = true; + result = result && nullSafeEquals(this.itemType, other.itemType); + result = result && nullSafeEquals(this.name, other.name); + result = result && nullSafeEquals(this.type, other.type); + result = result && nullSafeEquals(this.description, other.description); + result = result && nullSafeEquals(this.sourceType, other.sourceType); + result = result && nullSafeEquals(this.sourceMethod, other.sourceMethod); + result = result && nullSafeEquals(this.defaultValue, other.defaultValue); + result = result && nullSafeEquals(this.deprecation, other.deprecation); + return result; } @Override diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java index 94647aebc28..5115a1f7034 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java @@ -352,12 +352,12 @@ public class ConfigurationMetadataAnnotationProcessorTests { @Test public void innerClassPropertiesHierachical() throws Exception { ConfigurationMetadata metadata = compile(InnerClassHierachicalProperties.class); - assertThat(metadata) - .has(Metadata.withGroup("config.foo").ofType(InnerClassHierachicalProperties.Foo.class)); - assertThat(metadata).has( - Metadata.withGroup("config.foo.bar").ofType(InnerClassHierachicalProperties.Bar.class)); - assertThat(metadata).has( - Metadata.withGroup("config.foo.bar.baz").ofType(InnerClassHierachicalProperties.Foo.Baz.class)); + assertThat(metadata).has(Metadata.withGroup("config.foo") + .ofType(InnerClassHierachicalProperties.Foo.class)); + assertThat(metadata).has(Metadata.withGroup("config.foo.bar") + .ofType(InnerClassHierachicalProperties.Bar.class)); + assertThat(metadata).has(Metadata.withGroup("config.foo.bar.baz") + .ofType(InnerClassHierachicalProperties.Foo.Baz.class)); assertThat(metadata).has(Metadata.withProperty("config.foo.bar.baz.blah")); assertThat(metadata).has(Metadata.withProperty("config.foo.bar.bling")); } @@ -505,8 +505,8 @@ public class ConfigurationMetadataAnnotationProcessorTests { @Test public void lombokInnerClassWithGetterProperties() throws IOException { - ConfigurationMetadata metadata = - compile(LombokInnerClassWithGetterProperties.class); + ConfigurationMetadata metadata = compile( + LombokInnerClassWithGetterProperties.class); assertThat(metadata).has(Metadata.withGroup("config") .fromSource(LombokInnerClassWithGetterProperties.class)); assertThat(metadata).has(Metadata.withGroup("config.first") diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/specific/InnerClassHierachicalProperties.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/specific/InnerClassHierachicalProperties.java index 9ba9bd8c94d..e27c2910549 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/specific/InnerClassHierachicalProperties.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/specific/InnerClassHierachicalProperties.java @@ -19,8 +19,8 @@ package org.springframework.boot.configurationsample.specific; import org.springframework.boot.configurationsample.ConfigurationProperties; /** - * Demonstrate inner classes end up in metadata regardless of - * position in hierarchy and without the use of + * Demonstrate inner classes end up in metadata regardless of position in hierarchy and + * without the use of * {@link org.springframework.boot.configurationsample.NestedConfigurationProperty}. * * @author Madhura Bhave @@ -61,7 +61,9 @@ public class InnerClassHierachicalProperties { public void setBlah(String blah) { this.blah = blah; } + } + } public static class Bar { @@ -85,6 +87,7 @@ public class InnerClassHierachicalProperties { public void setBaz(Foo.Baz baz) { this.baz = baz; } + } } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/HandlerTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/HandlerTests.java index 501eb69ef1d..89dd432ab7f 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/HandlerTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/HandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java b/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java index 479206bbf0a..db68f37e203 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java @@ -103,4 +103,5 @@ public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerF public void setDirectBuffers(Boolean directBuffers) { this.directBuffers = directBuffers; } + } diff --git a/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/GenericReactiveWebApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/GenericReactiveWebApplicationContext.java index 724dd752861..38deb961232 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/GenericReactiveWebApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/GenericReactiveWebApplicationContext.java @@ -23,6 +23,7 @@ import java.io.InputStream; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.core.io.AbstractResource; import org.springframework.core.io.Resource; +import org.springframework.util.StringUtils; /** * Subclass of {@link AnnotationConfigApplicationContext}, suitable for reactive web @@ -37,8 +38,6 @@ public class GenericReactiveWebApplicationContext extends private String namespace; - private final NonExistentResource nonExistentResource = new NonExistentResource(); - public GenericReactiveWebApplicationContext() { super(); } @@ -59,24 +58,25 @@ public class GenericReactiveWebApplicationContext extends @Override protected Resource getResourceByPath(String path) { - // No ServletContext is available - if (path.startsWith("/")) { - return this.nonExistentResource; - } - else { - return super.getResourceByPath(path); - } + // We must be careful not to expose classpath resources + return new FilteredReactiveWebContextResource(path); } /** * Resource implementation that replaces the - * {@link org.springframework.web.context.support.ServletContextResource} - * in a reactive web application. - * - *

{@link #exists()} always returns null in order to avoid exposing - * the whole classpath in a non-servlet environment. + * {@link org.springframework.web.context.support.ServletContextResource} in a + * reactive web application. + *

+ * {@link #exists()} always returns null in order to avoid exposing the whole + * classpath in a non-servlet environment. */ - class NonExistentResource extends AbstractResource { + class FilteredReactiveWebContextResource extends AbstractResource { + + private final String path; + + FilteredReactiveWebContextResource(String path) { + this.path = path; + } @Override public boolean exists() { @@ -85,17 +85,20 @@ public class GenericReactiveWebApplicationContext extends @Override public Resource createRelative(String relativePath) throws IOException { - return this; + String pathToUse = StringUtils.applyRelativePath(this.path, relativePath); + return new FilteredReactiveWebContextResource(pathToUse); } @Override public String getDescription() { - return "NonExistentResource"; + return "ReactiveWebContext resource [" + this.path + "]"; } @Override public InputStream getInputStream() throws IOException { - throw new FileNotFoundException(this.getDescription() + " cannot be opened because it does not exist"); + throw new FileNotFoundException(this.getDescription() + + " cannot be opened because it does not exist"); } + } } diff --git a/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java index f7b166b42de..6ac947cab51 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java @@ -57,4 +57,5 @@ public class TomcatReactiveWebServerFactoryTests ordered.verify(listener).customize(any(Context.class)); } } + } diff --git a/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/GenericReactiveWebApplicationContextTests.java b/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/GenericReactiveWebApplicationContextTests.java index ba30d886d19..be213405ce2 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/GenericReactiveWebApplicationContextTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/GenericReactiveWebApplicationContextTests.java @@ -34,7 +34,9 @@ public class GenericReactiveWebApplicationContextTests { GenericReactiveWebApplicationContext context = new GenericReactiveWebApplicationContext(); Resource rootResource = context.getResourceByPath("/"); assertThat(rootResource.exists()).isFalse(); - assertThat(rootResource.createRelative("application.properties").exists()).isFalse(); + assertThat(rootResource.createRelative("application.properties").exists()) + .isFalse(); + context.close(); } }