Commit a09c64e1 authored by Andy Wilkinson's avatar Andy Wilkinson

Polish

parent 70c61381
...@@ -117,7 +117,7 @@ public class MetricsAutoConfigurationTests { ...@@ -117,7 +117,7 @@ public class MetricsAutoConfigurationTests {
@Test @Test
public void propertyBasedMeterFilter() { public void propertyBasedMeterFilter() {
this.contextRunner.withPropertyValues("management.metrics.enable.my.org=false") this.contextRunner.withPropertyValues("management.metrics.enable.my.org=false")
.run(context -> { .run((context) -> {
MeterRegistry registry = context.getBean(MeterRegistry.class); MeterRegistry registry = context.getBean(MeterRegistry.class);
registry.timer("my.org.timer"); registry.timer("my.org.timer");
assertThat(registry.find("my.org.timer").timer()).isNull(); assertThat(registry.find("my.org.timer").timer()).isNull();
......
...@@ -50,8 +50,10 @@ public class EmbeddedLdapAutoConfigurationTests { ...@@ -50,8 +50,10 @@ public class EmbeddedLdapAutoConfigurationTests {
@Test @Test
public void testSetDefaultPort() { public void testSetDefaultPort() {
this.contextRunner.withPropertyValues("spring.ldap.embedded.port:1234", this.contextRunner
"spring.ldap.embedded.base-dn:dc=spring,dc=org").run(context -> { .withPropertyValues("spring.ldap.embedded.port:1234",
"spring.ldap.embedded.base-dn:dc=spring,dc=org")
.run((context) -> {
InMemoryDirectoryServer server = context InMemoryDirectoryServer server = context
.getBean(InMemoryDirectoryServer.class); .getBean(InMemoryDirectoryServer.class);
assertThat(server.getListenPort()).isEqualTo(1234); assertThat(server.getListenPort()).isEqualTo(1234);
...@@ -62,7 +64,7 @@ public class EmbeddedLdapAutoConfigurationTests { ...@@ -62,7 +64,7 @@ public class EmbeddedLdapAutoConfigurationTests {
public void testRandomPortWithEnvironment() { public void testRandomPortWithEnvironment() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.ldap.embedded.base-dn:dc=spring,dc=org") .withPropertyValues("spring.ldap.embedded.base-dn:dc=spring,dc=org")
.run(context -> { .run((context) -> {
InMemoryDirectoryServer server = context InMemoryDirectoryServer server = context
.getBean(InMemoryDirectoryServer.class); .getBean(InMemoryDirectoryServer.class);
assertThat(server.getListenPort()).isEqualTo(context.getEnvironment() assertThat(server.getListenPort()).isEqualTo(context.getEnvironment()
...@@ -90,7 +92,7 @@ public class EmbeddedLdapAutoConfigurationTests { ...@@ -90,7 +92,7 @@ public class EmbeddedLdapAutoConfigurationTests {
.withPropertyValues("spring.ldap.embedded.base-dn:dc=spring,dc=org", .withPropertyValues("spring.ldap.embedded.base-dn:dc=spring,dc=org",
"spring.ldap.embedded.credential.username:uid=root", "spring.ldap.embedded.credential.username:uid=root",
"spring.ldap.embedded.credential.password:boot") "spring.ldap.embedded.credential.password:boot")
.run(context -> { .run((context) -> {
InMemoryDirectoryServer server = context InMemoryDirectoryServer server = context
.getBean(InMemoryDirectoryServer.class); .getBean(InMemoryDirectoryServer.class);
BindResult result = server.bind("uid=root", "boot"); BindResult result = server.bind("uid=root", "boot");
...@@ -102,7 +104,7 @@ public class EmbeddedLdapAutoConfigurationTests { ...@@ -102,7 +104,7 @@ public class EmbeddedLdapAutoConfigurationTests {
public void testSetPartitionSuffix() { public void testSetPartitionSuffix() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.ldap.embedded.base-dn:dc=spring,dc=org") .withPropertyValues("spring.ldap.embedded.base-dn:dc=spring,dc=org")
.run(context -> { .run((context) -> {
InMemoryDirectoryServer server = context InMemoryDirectoryServer server = context
.getBean(InMemoryDirectoryServer.class); .getBean(InMemoryDirectoryServer.class);
assertThat(server.getBaseDNs()) assertThat(server.getBaseDNs())
...@@ -114,7 +116,7 @@ public class EmbeddedLdapAutoConfigurationTests { ...@@ -114,7 +116,7 @@ public class EmbeddedLdapAutoConfigurationTests {
public void testSetLdifFile() { public void testSetLdifFile() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.ldap.embedded.base-dn:dc=spring,dc=org") .withPropertyValues("spring.ldap.embedded.base-dn:dc=spring,dc=org")
.run(context -> { .run((context) -> {
InMemoryDirectoryServer server = context InMemoryDirectoryServer server = context
.getBean(InMemoryDirectoryServer.class); .getBean(InMemoryDirectoryServer.class);
assertThat(server assertThat(server
...@@ -129,7 +131,7 @@ public class EmbeddedLdapAutoConfigurationTests { ...@@ -129,7 +131,7 @@ public class EmbeddedLdapAutoConfigurationTests {
.withPropertyValues("spring.ldap.embedded.base-dn:dc=spring,dc=org") .withPropertyValues("spring.ldap.embedded.base-dn:dc=spring,dc=org")
.withConfiguration(AutoConfigurations.of(LdapAutoConfiguration.class, .withConfiguration(AutoConfigurations.of(LdapAutoConfiguration.class,
LdapDataAutoConfiguration.class)) LdapDataAutoConfiguration.class))
.run(context -> { .run((context) -> {
assertThat(context.getBeanNamesForType(LdapTemplate.class).length) assertThat(context.getBeanNamesForType(LdapTemplate.class).length)
.isEqualTo(1); .isEqualTo(1);
LdapTemplate ldapTemplate = context.getBean(LdapTemplate.class); LdapTemplate ldapTemplate = context.getBean(LdapTemplate.class);
...@@ -143,7 +145,7 @@ public class EmbeddedLdapAutoConfigurationTests { ...@@ -143,7 +145,7 @@ public class EmbeddedLdapAutoConfigurationTests {
this.contextRunner this.contextRunner
.withPropertyValues("spring.ldap.embedded.validation.enabled:false", .withPropertyValues("spring.ldap.embedded.validation.enabled:false",
"spring.ldap.embedded.base-dn:dc=spring,dc=org") "spring.ldap.embedded.base-dn:dc=spring,dc=org")
.run(context -> { .run((context) -> {
InMemoryDirectoryServer server = context InMemoryDirectoryServer server = context
.getBean(InMemoryDirectoryServer.class); .getBean(InMemoryDirectoryServer.class);
assertThat(server.getSchema()).isNull(); assertThat(server.getSchema()).isNull();
...@@ -155,7 +157,7 @@ public class EmbeddedLdapAutoConfigurationTests { ...@@ -155,7 +157,7 @@ public class EmbeddedLdapAutoConfigurationTests {
this.contextRunner.withPropertyValues( this.contextRunner.withPropertyValues(
"spring.ldap.embedded.validation.schema:classpath:custom-schema.ldif", "spring.ldap.embedded.validation.schema:classpath:custom-schema.ldif",
"spring.ldap.embedded.ldif:classpath:custom-schema-sample.ldif", "spring.ldap.embedded.ldif:classpath:custom-schema-sample.ldif",
"spring.ldap.embedded.base-dn:dc=spring,dc=org").run(context -> { "spring.ldap.embedded.base-dn:dc=spring,dc=org").run((context) -> {
InMemoryDirectoryServer server = context InMemoryDirectoryServer server = context
.getBean(InMemoryDirectoryServer.class); .getBean(InMemoryDirectoryServer.class);
...@@ -174,7 +176,7 @@ public class EmbeddedLdapAutoConfigurationTests { ...@@ -174,7 +176,7 @@ public class EmbeddedLdapAutoConfigurationTests {
"spring.ldap.embedded.ldif:classpath:schema-multi-basedn.ldif", "spring.ldap.embedded.ldif:classpath:schema-multi-basedn.ldif",
"spring.ldap.embedded.base-dn[0]:dc=spring,dc=org", "spring.ldap.embedded.base-dn[0]:dc=spring,dc=org",
"spring.ldap.embedded.base-dn[1]:dc=pivotal,dc=io") "spring.ldap.embedded.base-dn[1]:dc=pivotal,dc=io")
.run(context -> { .run((context) -> {
InMemoryDirectoryServer server = context InMemoryDirectoryServer server = context
.getBean(InMemoryDirectoryServer.class); .getBean(InMemoryDirectoryServer.class);
assertThat(server assertThat(server
......
...@@ -41,7 +41,7 @@ public class WebFluxSecurityConfigurationTests { ...@@ -41,7 +41,7 @@ public class WebFluxSecurityConfigurationTests {
this.contextRunner this.contextRunner
.withUserConfiguration(WebFilterChainProxyConfiguration.class, .withUserConfiguration(WebFilterChainProxyConfiguration.class,
WebFluxSecurityConfiguration.class) WebFluxSecurityConfiguration.class)
.run(context -> assertThat(context) .run((context) -> assertThat(context)
.doesNotHaveBean(WebFluxSecurityConfiguration.class)); .doesNotHaveBean(WebFluxSecurityConfiguration.class));
} }
......
...@@ -64,7 +64,7 @@ final class JavaPluginAction implements PluginApplicationAction { ...@@ -64,7 +64,7 @@ final class JavaPluginAction implements PluginApplicationAction {
disableJarTask(project); disableJarTask(project);
configureBuildTask(project); configureBuildTask(project);
BootJar bootJar = configureBootJarTask(project); BootJar bootJar = configureBootJarTask(project);
configureArtifactPublication(project, bootJar); configureArtifactPublication(bootJar);
configureBootRunTask(project); configureBootRunTask(project);
configureUtf8Encoding(project); configureUtf8Encoding(project);
configureParametersCompilerArg(project); configureParametersCompilerArg(project);
...@@ -98,7 +98,7 @@ final class JavaPluginAction implements PluginApplicationAction { ...@@ -98,7 +98,7 @@ final class JavaPluginAction implements PluginApplicationAction {
return bootJar; return bootJar;
} }
private void configureArtifactPublication(Project project, BootJar bootJar) { private void configureArtifactPublication(BootJar bootJar) {
ArchivePublishArtifact artifact = new ArchivePublishArtifact(bootJar); ArchivePublishArtifact artifact = new ArchivePublishArtifact(bootJar);
this.singlePublishedArtifact.addCandidate(artifact); this.singlePublishedArtifact.addCandidate(artifact);
} }
...@@ -140,14 +140,12 @@ final class JavaPluginAction implements PluginApplicationAction { ...@@ -140,14 +140,12 @@ final class JavaPluginAction implements PluginApplicationAction {
} }
private void configureAdditionalMetadataLocations(Project project) { private void configureAdditionalMetadataLocations(Project project) {
project.afterEvaluate((evaluated) -> { project.afterEvaluate((evaluated) ->
evaluated.getTasks().withType(JavaCompile.class, evaluated.getTasks().withType(JavaCompile.class,
(compile) -> configureAdditionalMetadataLocations(project, compile)); this::configureAdditionalMetadataLocations));
});
} }
private void configureAdditionalMetadataLocations(Project project, private void configureAdditionalMetadataLocations(JavaCompile compile) {
JavaCompile compile) {
compile.doFirst((task) -> { compile.doFirst((task) -> {
if (hasConfigurationProcessorOnClasspath(compile)) { if (hasConfigurationProcessorOnClasspath(compile)) {
findMatchingSourceSet(compile).ifPresent((sourceSet) -> { findMatchingSourceSet(compile).ifPresent((sourceSet) -> {
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -27,6 +27,7 @@ import org.gradle.api.Project; ...@@ -27,6 +27,7 @@ import org.gradle.api.Project;
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
@SuppressWarnings("serial")
public class BuildInfoProperties implements Serializable { public class BuildInfoProperties implements Serializable {
private final transient Project project; private final transient Project project;
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -30,6 +30,7 @@ import org.springframework.boot.loader.tools.FileUtils; ...@@ -30,6 +30,7 @@ import org.springframework.boot.loader.tools.FileUtils;
* @author Andy Wilkinson * @author Andy Wilkinson
* @since 2.0.0 * @since 2.0.0
*/ */
@SuppressWarnings("serial")
public class LaunchScriptConfiguration implements Serializable { public class LaunchScriptConfiguration implements Serializable {
private final Map<String, String> properties = new HashMap<>(); private final Map<String, String> properties = new HashMap<>();
......
...@@ -129,21 +129,21 @@ class JavaBeanBinder implements BeanBinder { ...@@ -129,21 +129,21 @@ class JavaBeanBinder implements BeanBinder {
name = Introspector.decapitalize(name.substring(3)); name = Introspector.decapitalize(name.substring(3));
this.properties this.properties
.computeIfAbsent(name, .computeIfAbsent(name,
n -> new BeanProperty(n, this.resolvableType)) (n) -> new BeanProperty(n, this.resolvableType))
.addGetter(method); .addGetter(method);
} }
else if (name.startsWith("is") && parameterCount == 0) { else if (name.startsWith("is") && parameterCount == 0) {
name = Introspector.decapitalize(name.substring(2)); name = Introspector.decapitalize(name.substring(2));
this.properties this.properties
.computeIfAbsent(name, .computeIfAbsent(name,
n -> new BeanProperty(n, this.resolvableType)) (n) -> new BeanProperty(n, this.resolvableType))
.addGetter(method); .addGetter(method);
} }
else if (name.startsWith("set") && parameterCount == 1) { else if (name.startsWith("set") && parameterCount == 1) {
name = Introspector.decapitalize(name.substring(3)); name = Introspector.decapitalize(name.substring(3));
this.properties this.properties
.computeIfAbsent(name, .computeIfAbsent(name,
n -> new BeanProperty(n, this.resolvableType)) (n) -> new BeanProperty(n, this.resolvableType))
.addSetter(method); .addSetter(method);
} }
} }
......
...@@ -287,6 +287,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { ...@@ -287,6 +287,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
assertThat(foo.getFoos().get("1")).isNotNull(); assertThat(foo.getFoos().get("1")).isNotNull();
} }
@SuppressWarnings("rawtypes")
@Test @Test
public void bindToBeanWithGenerics() { public void bindToBeanWithGenerics() {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
......
...@@ -280,6 +280,7 @@ public class BinderTests { ...@@ -280,6 +280,7 @@ public class BinderTests {
this.binder.bind("foo", target); this.binder.bind("foo", target);
} }
@SuppressWarnings("rawtypes")
@Test @Test
public void bindToBeanWithUnresolvableGenerics() { public void bindToBeanWithUnresolvableGenerics() {
MockConfigurationPropertySource source = new MockConfigurationPropertySource(); MockConfigurationPropertySource source = new MockConfigurationPropertySource();
......
...@@ -28,6 +28,7 @@ import org.springframework.security.provisioning.InMemoryUserDetailsManager; ...@@ -28,6 +28,7 @@ import org.springframework.security.provisioning.InMemoryUserDetailsManager;
@Configuration @Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter { public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@SuppressWarnings("deprecation")
@Bean @Bean
public InMemoryUserDetailsManager inMemoryUserDetailsManager() { public InMemoryUserDetailsManager inMemoryUserDetailsManager() {
return new InMemoryUserDetailsManager( return new InMemoryUserDetailsManager(
......
...@@ -87,6 +87,7 @@ public class SampleSecureWebFluxCustomSecurityTests { ...@@ -87,6 +87,7 @@ public class SampleSecureWebFluxCustomSecurityTests {
@Configuration @Configuration
static class SecurityConfiguration { static class SecurityConfiguration {
@SuppressWarnings("deprecation")
@Bean @Bean
public MapReactiveUserDetailsService userDetailsService() { public MapReactiveUserDetailsService userDetailsService() {
return new MapReactiveUserDetailsService( return new MapReactiveUserDetailsService(
......
...@@ -70,6 +70,7 @@ public class SampleMethodSecurityApplication implements WebMvcConfigurer { ...@@ -70,6 +70,7 @@ public class SampleMethodSecurityApplication implements WebMvcConfigurer {
@Configuration @Configuration
protected static class AuthenticationSecurity { protected static class AuthenticationSecurity {
@SuppressWarnings("deprecation")
@Bean @Bean
public InMemoryUserDetailsManager inMemoryUserDetailsManager() throws Exception { public InMemoryUserDetailsManager inMemoryUserDetailsManager() throws Exception {
return new InMemoryUserDetailsManager( return new InMemoryUserDetailsManager(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment