diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java index de30335deb..e6855de2f7 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java @@ -244,7 +244,8 @@ public class HealthIndicatorAutoConfiguration { private final Map ldapOperations; - public LdapHealthIndicatorConfiguration(Map ldapOperations) { + public LdapHealthIndicatorConfiguration( + Map ldapOperations) { this.ldapOperations = ldapOperations; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/LdapHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/LdapHealthIndicator.java index 3456b4703b..668c1df591 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/LdapHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/LdapHealthIndicator.java @@ -57,6 +57,7 @@ public class LdapHealthIndicator extends AbstractHealthIndicator { } return null; } + } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java index 9b3a33831d..36630d4ab0 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java @@ -541,8 +541,8 @@ public class HealthIndicatorAutoConfigurationTests { public void ldapHealthIndicator() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, "management.health.diskspace.enabled:false"); - this.context.register(LdapConfiguration.class, - ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); + this.context.register(LdapConfiguration.class, ManagementServerProperties.class, + HealthIndicatorAutoConfiguration.class); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -556,8 +556,8 @@ public class HealthIndicatorAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "management.health.diskspace.enabled:false", "management.health.ldap.enabled:false"); - this.context.register(LdapConfiguration.class, - ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); + this.context.register(LdapConfiguration.class, ManagementServerProperties.class, + HealthIndicatorAutoConfiguration.class); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/LdapHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/LdapHealthIndicatorTests.java index 1551506c0b..e2a6afebf5 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/LdapHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/LdapHealthIndicatorTests.java @@ -62,31 +62,33 @@ public class LdapHealthIndicatorTests { this.context.register(LdapAutoConfiguration.class, LdapDataAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, - EndpointAutoConfiguration.class, - HealthIndicatorAutoConfiguration.class); + EndpointAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); LdapTemplate ldapTemplate = this.context.getBean(LdapTemplate.class); assertThat(ldapTemplate).isNotNull(); - LdapHealthIndicator healthIndicator = this.context.getBean( - LdapHealthIndicator.class); + LdapHealthIndicator healthIndicator = this.context + .getBean(LdapHealthIndicator.class); assertThat(healthIndicator).isNotNull(); } @Test + @SuppressWarnings("unchecked") public void ldapIsUp() { LdapTemplate ldapTemplate = mock(LdapTemplate.class); - given(ldapTemplate.executeReadOnly(any(ContextExecutor.class))).willReturn("3"); + given(ldapTemplate.executeReadOnly((ContextExecutor) any())) + .willReturn("3"); LdapHealthIndicator healthIndicator = new LdapHealthIndicator(ldapTemplate); Health health = healthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails().get("version")).isEqualTo("3"); - verify(ldapTemplate).executeReadOnly(any(ContextExecutor.class)); + verify(ldapTemplate).executeReadOnly((ContextExecutor) any()); } @Test + @SuppressWarnings("unchecked") public void ldapIsDown() { LdapTemplate ldapTemplate = mock(LdapTemplate.class); - given(ldapTemplate.executeReadOnly(any(ContextExecutor.class))) + given(ldapTemplate.executeReadOnly((ContextExecutor) any())) .willThrow(new CommunicationException( new javax.naming.CommunicationException("Connection failed"))); LdapHealthIndicator healthIndicator = new LdapHealthIndicator(ldapTemplate); @@ -94,7 +96,7 @@ public class LdapHealthIndicatorTests { assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat((String) health.getDetails().get("error")) .contains("Connection failed"); - verify(ldapTemplate).executeReadOnly(any(ContextExecutor.class)); + verify(ldapTemplate).executeReadOnly((ContextExecutor) any()); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfiguration.java index 1cc0bd44b8..8817c47335 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfiguration.java @@ -28,8 +28,7 @@ import org.springframework.data.ldap.repository.LdapRepository; import org.springframework.data.ldap.repository.support.LdapRepositoryFactoryBean; /** - * {@link EnableAutoConfiguration Auto-configuration} for Spring Data's LDAP - * Repositories. + * {@link EnableAutoConfiguration Auto-configuration} for Spring Data's LDAP Repositories. * * @author EddĂș MelĂ©ndez * @since 1.5.0 diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java index 36d99a3fe6..12cc1f723e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java @@ -48,8 +48,8 @@ public class SecurityProperties implements SecurityPrerequisite { /** * Order applied to the WebSecurityConfigurerAdapter that is used to configure basic * authentication for application endpoints. If you want to add your own - * authentication for all or some of those endpoints the best thing to do is to add your - * own WebSecurityConfigurerAdapter with lower order. + * authentication for all or some of those endpoints the best thing to do is to add + * your own WebSecurityConfigurerAdapter with lower order. */ public static final int BASIC_AUTH_ORDER = Ordered.LOWEST_PRECEDENCE - 5; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/DefaultUserInfoRestTemplateFactory.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/DefaultUserInfoRestTemplateFactory.java index c1be6054e7..ac30aeec06 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/DefaultUserInfoRestTemplateFactory.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/DefaultUserInfoRestTemplateFactory.java @@ -66,11 +66,13 @@ public class DefaultUserInfoRestTemplateFactory implements UserInfoRestTemplateF this.oauth2ClientContext = oauth2ClientContext.getIfAvailable(); } + @Override public OAuth2RestTemplate getUserInfoRestTemplate() { if (this.oauth2RestTemplate == null) { this.oauth2RestTemplate = createOAuth2RestTemplate( this.details == null ? DEFAULT_RESOURCE_DETAILS : this.details); - this.oauth2RestTemplate.getInterceptors().add(new AcceptJsonRequestInterceptor()); + this.oauth2RestTemplate.getInterceptors() + .add(new AcceptJsonRequestInterceptor()); AuthorizationCodeAccessTokenProvider accessTokenProvider = new AuthorizationCodeAccessTokenProvider(); accessTokenProvider.setTokenRequestEnhancer(new AcceptJsonRequestEnhancer()); this.oauth2RestTemplate.setAccessTokenProvider(accessTokenProvider); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java index f5729b6b26..78c64d126c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java @@ -88,7 +88,8 @@ public class ResourceServerTokenServicesConfiguration { ObjectProvider> customizers, ObjectProvider details, ObjectProvider oauth2ClientContext) { - return new DefaultUserInfoRestTemplateFactory(customizers, details, oauth2ClientContext); + return new DefaultUserInfoRestTemplateFactory(customizers, details, + oauth2ClientContext); } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java index f238b73b6f..dc2e7c8951 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java @@ -222,13 +222,16 @@ public class RepositoryRestMvcAutoConfigurationTests { } static class TestRepositoryRestConfigurer extends RepositoryRestConfigurerAdapter { + @Override - public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { + public void configureRepositoryRestConfiguration( + RepositoryRestConfiguration config) { config.setRepositoryDetectionStrategy(RepositoryDetectionStrategies.ALL); - config.setDefaultMediaType(MediaType.parseMediaType( - "application/my-custom-json")); + config.setDefaultMediaType( + MediaType.parseMediaType("application/my-custom-json")); config.setMaxPageSize(78); } + } } 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 9e3a196265..3deccd09f8 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 @@ -220,7 +220,7 @@ public class ResourceServerTokenServicesConfigurationTests { "security.oauth2.resource.userInfoUri:http://example.com"); this.context = new SpringApplicationBuilder( CustomUserInfoRestTemplateFactory.class, ResourceConfiguration.class) - .environment(this.environment).web(false).run(); + .environment(this.environment).web(false).run(); assertThat(this.context.getBeansOfType(UserInfoRestTemplateFactory.class)) .hasSize(1); assertThat(this.context.getBean(UserInfoRestTemplateFactory.class)) @@ -331,8 +331,8 @@ public class ResourceServerTokenServicesConfigurationTests { protected static class CustomUserInfoRestTemplateFactory implements UserInfoRestTemplateFactory { - private final OAuth2RestTemplate restTemplate = - new OAuth2RestTemplate(new AuthorizationCodeResourceDetails()); + private final OAuth2RestTemplate restTemplate = new OAuth2RestTemplate( + new AuthorizationCodeResourceDetails()); @Override public OAuth2RestTemplate getUserInfoRestTemplate() {