diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityService.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityService.java index f8660d9b84e..cdf4fa0e015 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityService.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityService.java @@ -117,10 +117,9 @@ class CloudFoundrySecurityService { private Map extractTokenKeys(Map response) { Map tokenKeys = new HashMap(); - List keys = (List) response.get("keys"); - for (Object key : keys) { + for (Object key : (List) response.get("keys")) { Map tokenKey = (Map) key; - tokenKeys.put((String) (tokenKey).get("kid"), (String) (tokenKey).get("value")); + tokenKeys.put((String) tokenKey.get("kid"), (String) tokenKey.get("value")); } return tokenKeys; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/Token.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/Token.java index 3ec7860687d..678df3a2bc2 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/Token.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/Token.java @@ -97,7 +97,6 @@ class Token { return getRequired(this.claims, "scope", List.class); } - @SuppressWarnings("unchecked") public String getKeyId() { return getRequired(this.header, "kid", String.class); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/TokenValidator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/TokenValidator.java index 31390775116..d63f0719ce8 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/TokenValidator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/TokenValidator.java @@ -52,8 +52,6 @@ class TokenValidator { validateAudience(token); } - - private void validateAlgorithm(Token token) { String algorithm = token.getSignatureAlgorithm(); if (algorithm == null) { @@ -83,9 +81,9 @@ class TokenValidator { } } - private boolean hasValidKeyId(String tokenKeyId) { - for (String keyId: this.tokenKeys.keySet()) { - if (tokenKeyId.equals(keyId)) { + private boolean hasValidKeyId(String tokenKey) { + for (String candidate : this.tokenKeys.keySet()) { + if (tokenKey.equals(candidate)) { return true; } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/TokenValidatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/TokenValidatorTests.java index f1770fae1ac..1c52043908c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/TokenValidatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/TokenValidatorTests.java @@ -85,7 +85,8 @@ public class TokenValidatorTests { private static final Map INVALID_KEYS = Collections .singletonMap("invalid-key", INVALID_KEY); - private static final Map VALID_KEYS = Collections.singletonMap("valid-key", VALID_KEY); + private static final Map VALID_KEYS = Collections + .singletonMap("valid-key", VALID_KEY); @Before public void setup() throws Exception { @@ -100,8 +101,8 @@ public class TokenValidatorTests { given(this.securityService.fetchTokenKeys()).willReturn(INVALID_KEYS); String header = "{\"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}"; String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}"; - this.thrown.expect( - AuthorizationExceptionMatcher.withReason(Reason.INVALID_KEY_ID)); + this.thrown + .expect(AuthorizationExceptionMatcher.withReason(Reason.INVALID_KEY_ID)); this.tokenValidator.validate( new Token(getSignedToken(header.getBytes(), claims.getBytes()))); } @@ -131,8 +132,7 @@ public class TokenValidatorTests { } @Test - public void validateTokenWhenValidShouldNotFetchTokenKeys() - throws Exception { + public void validateTokenWhenValidShouldNotFetchTokenKeys() throws Exception { ReflectionTestUtils.setField(this.tokenValidator, "tokenKeys", VALID_KEYS); given(this.securityService.getUaaUrl()).willReturn("http://localhost:8080/uaa"); String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}"; @@ -144,7 +144,8 @@ public class TokenValidatorTests { @Test public void validateTokenWhenSignatureInvalidShouldThrowException() throws Exception { - ReflectionTestUtils.setField(this.tokenValidator, "tokenKeys", Collections.singletonMap("valid-key", INVALID_KEY)); + ReflectionTestUtils.setField(this.tokenValidator, "tokenKeys", + Collections.singletonMap("valid-key", INVALID_KEY)); given(this.securityService.getUaaUrl()).willReturn("http://localhost:8080/uaa"); String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}"; String claims = "{ \"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}"; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java index 54e5ae5724a..200fe4bcb55 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java @@ -109,24 +109,7 @@ public class EmbeddedLdapAutoConfiguration { this.embeddedProperties.getCredential().getUsername(), this.embeddedProperties.getCredential().getPassword()); } - - if (!this.embeddedProperties.getValidation().isEnabled()) { - config.setSchema(null); - } - else { - Resource schema = this.embeddedProperties.getValidation().getSchema(); - if (schema != null) { - try { - config.setSchema(Schema.mergeSchemas(Schema.getDefaultStandardSchema(), - Schema.getSchema(schema.getInputStream()))); - } - catch (Exception ex) { - throw new IllegalStateException( - "Unable to load schema " + schema.getDescription(), ex); - } - } - } - + setSchema(config); InMemoryListenerConfig listenerConfig = InMemoryListenerConfig .createLDAPConfig("LDAP", this.embeddedProperties.getPort()); config.setListenerConfigs(listenerConfig); @@ -137,6 +120,29 @@ public class EmbeddedLdapAutoConfiguration { return this.server; } + private void setSchema(InMemoryDirectoryServerConfig config) { + if (!this.embeddedProperties.getValidation().isEnabled()) { + config.setSchema(null); + return; + } + Resource schema = this.embeddedProperties.getValidation().getSchema(); + if (schema != null) { + setSchema(config, schema); + } + } + + private void setSchema(InMemoryDirectoryServerConfig config, Resource resource) { + try { + Schema defaultSchema = Schema.getDefaultStandardSchema(); + Schema schema = Schema.getSchema(resource.getInputStream()); + config.setSchema(Schema.mergeSchemas(defaultSchema, schema)); + } + catch (Exception ex) { + throw new IllegalStateException( + "Unable to load schema " + resource.getDescription(), ex); + } + } + private boolean hasCredentials(Credential credential) { return StringUtils.hasText(credential.getUsername()) && StringUtils.hasText(credential.getPassword()); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerProperties.java index df290a76b72..275eff8d494 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerProperties.java @@ -203,31 +203,36 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware { return; } ResourceServerProperties resource = (ResourceServerProperties) target; + validate(resource, errors); + } + + private void validate(ResourceServerProperties target, Errors errors) { if ((StringUtils.hasText(this.jwt.getKeyUri()) || StringUtils.hasText(this.jwt.getKeyValue())) && StringUtils.hasText(this.jwk.getKeySetUri())) { - errors.reject("ambiguous.keyUri", "Only one of jwt.keyUri (or jwt.keyValue) and jwk.keySetUri should be configured."); + errors.reject("ambiguous.keyUri", + "Only one of jwt.keyUri (or jwt.keyValue) and " + + "jwk.keySetUri should be configured."); } - else { if (StringUtils.hasText(this.clientId)) { if (!StringUtils.hasText(this.clientSecret)) { - if (!StringUtils.hasText(resource.getUserInfoUri())) { + if (!StringUtils.hasText(target.getUserInfoUri())) { errors.rejectValue("userInfoUri", "missing.userInfoUri", "Missing userInfoUri (no client secret available)"); } } else { if (isPreferTokenInfo() - && !StringUtils.hasText(resource.getTokenInfoUri())) { + && !StringUtils.hasText(target.getTokenInfoUri())) { if (StringUtils.hasText(getJwt().getKeyUri()) || StringUtils.hasText(getJwt().getKeyValue()) || StringUtils.hasText(getJwk().getKeySetUri())) { // It's a JWT decoder return; } - if (!StringUtils.hasText(resource.getUserInfoUri())) { + if (!StringUtils.hasText(target.getUserInfoUri())) { errors.rejectValue("tokenInfoUri", "missing.tokenInfoUri", "Missing tokenInfoUri and userInfoUri and there is no " + "JWT verifier key"); @@ -236,7 +241,6 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware { } } } - } private int countBeans(Class type) { @@ -294,9 +298,8 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware { public class Jwk { /** - * The URI to get verification keys to verify the JWT token. - * This can be set when the authorization server returns a - * set of verification keys. + * The URI to get verification keys to verify the JWT token. This can be set when + * the authorization server returns a set of verification keys. */ private String keySetUri; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/SpringValidatorAdapterWrapper.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/SpringValidatorAdapterWrapper.java index 1fc4c430908..b44d770a493 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/SpringValidatorAdapterWrapper.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/SpringValidatorAdapterWrapper.java @@ -26,9 +26,9 @@ import org.springframework.validation.Validator; import org.springframework.validation.beanvalidation.SpringValidatorAdapter; /** - * Wraps a {@link SpringValidatorAdapter} so that only the Spring's {@link Validator} - * type is exposed. This prevents such a bean to expose both the Spring and JSR-303 - * validator contract at the same time. + * Wraps a {@link SpringValidatorAdapter} so that only the Spring's {@link Validator} type + * is exposed. This prevents such a bean to expose both the Spring and JSR-303 validator + * contract at the same time. * * @author Stephane Nicoll */ @@ -36,6 +36,7 @@ class SpringValidatorAdapterWrapper implements Validator, ApplicationContextAware, InitializingBean, DisposableBean { private final SpringValidatorAdapter target; + private final boolean managed; SpringValidatorAdapterWrapper(SpringValidatorAdapter target, boolean managed) { @@ -61,8 +62,8 @@ class SpringValidatorAdapterWrapper public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { if (!this.managed && this.target instanceof ApplicationContextAware) { - ((ApplicationContextAware) this.target).setApplicationContext( - applicationContext); + ((ApplicationContextAware) this.target) + .setApplicationContext(applicationContext); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java index b8e14ad7646..53e537166a8 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java @@ -575,15 +575,17 @@ public class WebMvcAutoConfiguration { try { if (this.userDefinedValidator != null) { if (this.userDefinedValidator instanceof javax.validation.Validator) { - return wrap((javax.validation.Validator) this.userDefinedValidator, false); + return wrap( + (javax.validation.Validator) this.userDefinedValidator, + false); } else { return this.userDefinedValidator; } } else { - return wrap(this.applicationContext.getBean( - javax.validation.Validator.class), true); + return wrap(this.applicationContext + .getBean(javax.validation.Validator.class), true); } } catch (NoSuchBeanDefinitionException ex) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProviderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProviderTests.java index 9ab21fa8186..0c963cf057f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProviderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProviderTests.java @@ -32,11 +32,11 @@ import static org.assertj.core.api.Assertions.assertThat; */ public class GroovyTemplateAvailabilityProviderTests { - private final TemplateAvailabilityProvider provider = new GroovyTemplateAvailabilityProvider(); + private TemplateAvailabilityProvider provider = new GroovyTemplateAvailabilityProvider(); - private final ResourceLoader resourceLoader = new DefaultResourceLoader(); + private ResourceLoader resourceLoader = new DefaultResourceLoader(); - private final MockEnvironment environment = new MockEnvironment(); + private MockEnvironment environment = new MockEnvironment(); @Test public void availabilityOfTemplateInDefaultLocation() { 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 0f41c99c62f..1c0a3838121 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 @@ -390,11 +390,13 @@ public class OAuth2AutoConfigurationTests { } @Test - public void resourceServerConditionWhenJwkConfigurationPresentShouldMatch() throws Exception { + public void resourceServerConditionWhenJwkConfigurationPresentShouldMatch() + throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, "security.oauth2.resource.jwk.key-set-uri:http://my-auth-server/token_keys"); - this.context.register(ResourceServerConfiguration.class, MinimalSecureWebApplication.class); + this.context.register(ResourceServerConfiguration.class, + MinimalSecureWebApplication.class); this.context.refresh(); assertThat(countBeans(RESOURCE_SERVER_CONFIG)).isEqualTo(1); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerPropertiesTests.java index 291da9b05e3..b53afd27355 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerPropertiesTests.java @@ -68,13 +68,15 @@ public class ResourceServerPropertiesTests { } @Test - public void validateWhenBothJwtAndJwtKeyConfigurationPresentShouldFail() throws Exception { + public void validateWhenBothJwtAndJwtKeyConfigurationPresentShouldFail() + throws Exception { this.properties.getJwk().setKeySetUri("http://my-auth-server/token_keys"); this.properties.getJwt().setKeyUri("http://my-auth-server/token_key"); setListableBeanFactory(); Errors errors = mock(Errors.class); this.properties.validate(this.properties, errors); - verify(errors).reject("ambiguous.keyUri", "Only one of jwt.keyUri (or jwt.keyValue) and jwk.keySetUri should be configured."); + verify(errors).reject("ambiguous.keyUri", + "Only one of jwt.keyUri (or jwt.keyValue) and jwk.keySetUri should be configured."); } @@ -89,14 +91,19 @@ public class ResourceServerPropertiesTests { private void setListableBeanFactory() { ListableBeanFactory beanFactory = new StaticWebApplicationContext() { + @Override - public String[] getBeanNamesForType(Class type, boolean includeNonSingletons, boolean allowEagerInit) { - if (type.isAssignableFrom(ResourceServerTokenServicesConfiguration.class)) { - return new String[]{"ResourceServerTokenServicesConfiguration"}; + public String[] getBeanNamesForType(Class type, + boolean includeNonSingletons, boolean allowEagerInit) { + if (type.isAssignableFrom( + ResourceServerTokenServicesConfiguration.class)) { + return new String[] { "ResourceServerTokenServicesConfiguration" }; } return new String[0]; } + }; this.properties.setBeanFactory(beanFactory); } + } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/SpringValidatorAdapterWrapperTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/SpringValidatorAdapterWrapperTests.java index ff1b9525a92..f85b5b53792 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/SpringValidatorAdapterWrapperTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/SpringValidatorAdapterWrapperTests.java @@ -57,8 +57,8 @@ public class SpringValidatorAdapterWrapperTests { SpringValidatorAdapterWrapper wrapper = load( LocalValidatorFactoryBeanConfig.class); assertThat(wrapper.supports(SampleData.class)).isTrue(); - MapBindingResult errors = new MapBindingResult( - new HashMap(), "test"); + MapBindingResult errors = new MapBindingResult(new HashMap(), + "test"); wrapper.validate(new SampleData(40), errors); assertThat(errors.getErrorCount()).isEqualTo(1); } @@ -66,8 +66,8 @@ public class SpringValidatorAdapterWrapperTests { @Test public void wrapperInvokesCallbackOnNonManagedBean() { load(NonManagedBeanConfig.class); - LocalValidatorFactoryBean validator = this.context.getBean( - NonManagedBeanConfig.class).validator; + LocalValidatorFactoryBean validator = this.context + .getBean(NonManagedBeanConfig.class).validator; verify(validator, times(1)).setApplicationContext(any(ApplicationContext.class)); verify(validator, times(1)).afterPropertiesSet(); verify(validator, times(0)).destroy(); @@ -79,8 +79,8 @@ public class SpringValidatorAdapterWrapperTests { @Test public void wrapperDoesNotInvokeCallbackOnManagedBean() { load(ManagedBeanConfig.class); - LocalValidatorFactoryBean validator = this.context.getBean( - ManagedBeanConfig.class).validator; + LocalValidatorFactoryBean validator = this.context + .getBean(ManagedBeanConfig.class).validator; verify(validator, times(0)).setApplicationContext(any(ApplicationContext.class)); verify(validator, times(0)).afterPropertiesSet(); verify(validator, times(0)).destroy(); @@ -115,8 +115,8 @@ public class SpringValidatorAdapterWrapperTests { @Configuration static class NonManagedBeanConfig { - private final LocalValidatorFactoryBean validator - = mock(LocalValidatorFactoryBean.class); + private final LocalValidatorFactoryBean validator = mock( + LocalValidatorFactoryBean.class); @Bean public SpringValidatorAdapterWrapper wrapper() { @@ -128,8 +128,8 @@ public class SpringValidatorAdapterWrapperTests { @Configuration static class ManagedBeanConfig { - private final LocalValidatorFactoryBean validator - = mock(LocalValidatorFactoryBean.class); + private final LocalValidatorFactoryBean validator = mock( + LocalValidatorFactoryBean.class); @Bean public SpringValidatorAdapterWrapper wrapper() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java index 652ade4f8ef..dccaa88c309 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java @@ -662,8 +662,8 @@ public class WebMvcAutoConfigurationTests { .isEmpty(); assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1); Validator validator = this.context.getBean(Validator.class); - assertThat(validator).isSameAs(this.context.getBean(MvcValidator.class) - .validator); + assertThat(validator) + .isSameAs(this.context.getBean(MvcValidator.class).validator); } @Test @@ -900,7 +900,7 @@ public class WebMvcAutoConfigurationTests { @Configuration protected static class MvcJsr303Validator extends WebMvcConfigurerAdapter { - private final LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); + private final LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); @Override public Validator getValidator() { diff --git a/spring-boot-samples/spring-boot-sample-cache/pom.xml b/spring-boot-samples/spring-boot-sample-cache/pom.xml index 8dfb924f40a..5be7c7e1aa8 100644 --- a/spring-boot-samples/spring-boot-sample-cache/pom.xml +++ b/spring-boot-samples/spring-boot-sample-cache/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 @@ -24,7 +25,7 @@ org.springframework.boot spring-boot-starter-cache - + org.springframework.boot spring-boot-starter-web diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java index 0c9159afad3..da50698104e 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java @@ -121,7 +121,8 @@ class MockDefinition extends Definition { MockDefinition other = (MockDefinition) obj; boolean result = super.equals(obj); result = result && ObjectUtils.nullSafeEquals(this.typeToMock, other.typeToMock); - result = result && ObjectUtils.nullSafeEquals(this.extraInterfaces, other.extraInterfaces); + result = result && ObjectUtils.nullSafeEquals(this.extraInterfaces, + other.extraInterfaces); result = result && ObjectUtils.nullSafeEquals(this.answer, other.answer); result = result && this.serializable == other.serializable; return result; diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java index 25c62188b4e..a808ab4039e 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java @@ -278,12 +278,19 @@ class ProjectLibraries implements Libraries { } + /** + * Strategy used to resolve configurations regardless of the underlying Gradle + * version. + */ private interface TargetConfigurationResolver { Configuration resolveTargetConfiguration(ProjectDependency projectDependency); } + /** + * {@link TargetConfigurationResolver} for Gradle 2.x. + */ private static final class Gradle2TargetConfigurationResolver implements TargetConfigurationResolver { @@ -295,6 +302,9 @@ class ProjectLibraries implements Libraries { } + /** + * {@link TargetConfigurationResolver} for Gradle 3.x. + */ private static final class Gradle3TargetConfigurationResolver implements TargetConfigurationResolver { 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 14cec13c5fe..710197bedf8 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 @@ -70,8 +70,7 @@ public class PropertySourcesPropertyValues implements PropertyValues { * Create a new PropertyValues from the given PropertySources that will optionally * resolve placeholders. * @param propertySources a PropertySources instance - * @param resolvePlaceholders {@code true} if placeholders should be resolved, - * otherwise {@code false} + * @param resolvePlaceholders {@code true} if placeholders should be resolved. * @since 1.5.2 */ public PropertySourcesPropertyValues(PropertySources propertySources, 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 1af4186b636..5e81e4543fd 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 @@ -529,6 +529,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { public void setFoo(String foo) { this.foo = foo; } + } @Configuration diff --git a/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java b/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java index 727be26b5b7..4e00c9ac983 100644 --- a/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java @@ -58,7 +58,8 @@ public class BindFailureAnalyzerTests { @Test public void bindExceptionWithFieldErrorsDueToValidationFailure() { - FailureAnalysis analysis = performAnalysis(FieldValidationFailureConfiguration.class); + FailureAnalysis analysis = performAnalysis( + FieldValidationFailureConfiguration.class); assertThat(analysis.getDescription()) .contains(failure("test.foo.foo", "null", "may not be null")); assertThat(analysis.getDescription()) @@ -69,7 +70,8 @@ public class BindFailureAnalyzerTests { @Test public void bindExceptionWithObjectErrorsDueToValidationFailure() throws Exception { - FailureAnalysis analysis = performAnalysis(ObjectValidationFailureConfiguration.class); + FailureAnalysis analysis = performAnalysis( + ObjectValidationFailureConfiguration.class); assertThat(analysis.getDescription()) .contains("Reason: This object could not be bound."); } @@ -171,6 +173,7 @@ public class BindFailureAnalyzerTests { public boolean supports(Class clazz) { return true; } + } }