diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfiguration.java index d40bb226602f..915e747ae153 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 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. @@ -20,6 +20,7 @@ import java.util.Map; import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceException; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.binder.jpa.HibernateMetrics; @@ -65,8 +66,14 @@ public void bindEntityManagerFactoriesToRegistry( private void bindEntityManagerFactoryToRegistry(String beanName, EntityManagerFactory entityManagerFactory, MeterRegistry registry) { String entityManagerFactoryName = getEntityManagerFactoryName(beanName); - new HibernateMetrics(entityManagerFactory, entityManagerFactoryName, - Collections.emptyList()).bindTo(registry); + try { + new HibernateMetrics(entityManagerFactory.unwrap(SessionFactory.class), + entityManagerFactoryName, Collections.emptyList()) + .bindTo(registry); + } + catch (PersistenceException ex) { + // Continue + } } /** diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java index c6147eb632e5..d136bcd14717 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java @@ -56,7 +56,7 @@ public void actuatorEndpointsWhenUserProvidedResourceConfigBeanNotAvailable() { testJerseyEndpoints(new Class[] { EndpointsConfiguration.class }); } - protected void testJerseyEndpoints(Class[] userConfigurations) { + protected void testJerseyEndpoints(Class[] userConfigurations) { FilteredClassLoader classLoader = new FilteredClassLoader( DispatcherServlet.class); new WebApplicationContextRunner( diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurerIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurerIntegrationTests.java index 4a1f2c89b739..a45dc4b433da 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurerIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 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. @@ -77,9 +77,7 @@ MeterBinder testBinder(Alpha thing) { @Bean MeterRegistryCustomizer testCustomizer() { - return (registry) -> { - registry.config().commonTags("testTag", "testValue"); - }; + return (registry) -> registry.config().commonTags("testTag", "testValue"); } @Bean diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchJestHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchJestHealthIndicatorTests.java index 340ffe1da7e9..ce909a663ec8 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchJestHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchJestHealthIndicatorTests.java @@ -62,6 +62,7 @@ public void elasticsearchIsUp() throws IOException { } @Test + @SuppressWarnings("unchecked") public void elasticsearchWithYellowStatusIsUp() throws IOException { given(this.jestClient.execute(any(Action.class))) .willReturn(createJestResult(200, true, "yellow")); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java index 2bb4946cbf53..ebe6e6834714 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java @@ -134,7 +134,6 @@ protected Mono renderErrorView(ServerRequest request) { protected Mono renderErrorResponse(ServerRequest request) { boolean includeStackTrace = isIncludeStackTrace(request, MediaType.ALL); Map error = getErrorAttributes(request, includeStackTrace); - HttpStatus errorStatus = getHttpStatus(error); return ServerResponse.status(getHttpStatus(error)) .contentType(MediaType.APPLICATION_JSON_UTF8) .body(BodyInserters.fromObject(error)); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java index 5683d5f2e6da..2160f9f0ec92 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java @@ -202,10 +202,8 @@ public void existingMessageSourceInParentIsIgnored() { public void messageSourceWithNonStandardBeanNameIsIgnored() { this.contextRunner.withPropertyValues("spring.messages.basename:test/messages") .withUserConfiguration(CustomBeanNameMessageSourceConfiguration.class) - .run((context) -> { - assertThat(context.getMessage("foo", null, Locale.US)) - .isEqualTo("bar"); - }); + .run((context) -> assertThat(context.getMessage("foo", null, Locale.US)) + .isEqualTo("bar")); } @Configuration diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java index bad2f2358fb1..95d36ad53ee9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java @@ -252,9 +252,8 @@ static class DownloadConfigBuilderCustomizerConfiguration { @Bean public DownloadConfigBuilderCustomizer testDownloadConfigBuilderCustomizer() { - return (downloadConfigBuilder) -> { - downloadConfigBuilder.userAgent("Test User Agent"); - }; + return (downloadConfigBuilder) -> downloadConfigBuilder + .userAgent("Test User Agent"); } } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java index c149bdac402e..820424e0c2e4 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 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. @@ -307,7 +307,6 @@ public void call(SourceUnit source, GeneratorContext context, ClassNode classNod private static class MainClass { - @SuppressWarnings("unchecked") public static ClassNode get(CompilationUnit source) { return get(source.getAST().getClasses()); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java index 0d4b2f9ab924..b6391d265c33 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java @@ -152,13 +152,9 @@ public void runWithFailedContextShouldReturnFailedAssertableContext() { @Test public void runWithClassLoaderShouldSetClassLoaderOnContext() { get().withClassLoader(new FilteredClassLoader(Gson.class.getPackage().getName())) - .run((context) -> { - assertThatExceptionOfType(ClassNotFoundException.class) - .isThrownBy(() -> { - ClassUtils.forName(Gson.class.getName(), - context.getClassLoader()); - }); - }); + .run((context) -> assertThatExceptionOfType(ClassNotFoundException.class) + .isThrownBy(() -> ClassUtils.forName(Gson.class.getName(), + context.getClassLoader()))); } @Test diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-docs/src/main/java/org/springframework/boot/configurationdocs/ConfigurationMetadataDocumentWriter.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-docs/src/main/java/org/springframework/boot/configurationdocs/ConfigurationMetadataDocumentWriter.java index 26b537d58615..d28964e641f5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-docs/src/main/java/org/springframework/boot/configurationdocs/ConfigurationMetadataDocumentWriter.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-docs/src/main/java/org/springframework/boot/configurationdocs/ConfigurationMetadataDocumentWriter.java @@ -92,9 +92,8 @@ private List createConfigTables( List matchingOverrides = overrides.keySet().stream() .filter((overrideKey) -> overrideKey.startsWith(keyPrefix)) .collect(Collectors.toList()); - matchingOverrides.forEach((match) -> { - table.addEntry(overrides.remove(match)); - }); + matchingOverrides.forEach((match) -> + table.addEntry(overrides.remove(match))); } List matchingKeys = unmappedKeys.stream() .filter((key) -> keyPrefixes.stream().anyMatch(key::startsWith)) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/AbstractGenericProperties.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/AbstractGenericProperties.java index 844ba0f6c67f..707f943a7c79 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/AbstractGenericProperties.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/AbstractGenericProperties.java @@ -22,6 +22,9 @@ /** * A base properties class with generics. * + * @param name type + * @param mapping key type + * @param mapping value type * @author Stephane Nicoll */ public class AbstractGenericProperties { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/AbstractIntermediateGenericProperties.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/AbstractIntermediateGenericProperties.java index 032eb01cc733..a843cec87d66 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/AbstractIntermediateGenericProperties.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/AbstractIntermediateGenericProperties.java @@ -19,6 +19,7 @@ /** * An intermediate layer that resolves some of the generics from the parent but not all. * + * @param mapping value type * @author Stephane Nicoll */ public abstract class AbstractIntermediateGenericProperties diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/UnresolvedGenericProperties.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/UnresolvedGenericProperties.java index b341feb4117e..d6d679e43817 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/UnresolvedGenericProperties.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/generic/UnresolvedGenericProperties.java @@ -21,6 +21,8 @@ /** * Properties with unresolved generic information. * + * @param mapping key type + * @param mapping value type * @author Stephane Nicoll */ @ConfigurationProperties("generic") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java index d2e2a3d49c70..ece13f8fa3ce 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java @@ -55,9 +55,8 @@ public BootJar() { getMainSpec().with(this.bootInf); this.bootInf.into("classes", classpathFiles(File::isDirectory)); this.bootInf.into("lib", classpathFiles(File::isFile)); - this.bootInf.filesMatching("module-info.class", (details) -> { - details.setRelativePath(details.getRelativeSourcePath()); - }); + this.bootInf.filesMatching("module-info.class", + (details) -> details.setRelativePath(details.getRelativeSourcePath())); getRootSpec().eachFile((details) -> { String pathString = details.getRelativePath().getPathString(); if (pathString.startsWith("BOOT-INF/lib/") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java index 9378dc386087..d33ea580ac9d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java @@ -54,9 +54,8 @@ public BootWar() { (copySpec) -> copySpec.from( (Callable>) () -> (this.providedClasspath != null) ? this.providedClasspath : Collections.emptyList())); - getRootSpec().filesMatching("module-info.class", (details) -> { - details.setRelativePath(details.getRelativeSourcePath()); - }); + getRootSpec().filesMatching("module-info.class", + (details) -> details.setRelativePath(details.getRelativeSourcePath())); getRootSpec().eachFile((details) -> { String pathString = details.getRelativePath().getPathString(); if ((pathString.startsWith("WEB-INF/lib/") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index 713f71bc5d35..1667a9c511c2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -80,6 +80,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { * @since 1.0 * @deprecated since version 2.2. Use agents instead. */ + @Deprecated @Parameter(property = "spring-boot.run.agent") private File[] agent; @@ -384,7 +385,6 @@ private void addAgents(List args) { } } - @SuppressWarnings("deprecation") private File[] determineAgents() { return (this.agents != null) ? this.agents : this.agent; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java index f83aa582f6d9..b94bee4d4143 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java @@ -128,7 +128,6 @@ public String toString() { * @return a {@link LogFile} or {@code null} if the environment didn't contain any * suitable properties */ - @SuppressWarnings("deprecation") public static LogFile get(PropertyResolver propertyResolver) { String file = getLogFileProperty(propertyResolver, FILE_NAME_PROPERTY, FILE_PROPERTY); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java index 45029e476ad4..be8cb8658482 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 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. @@ -38,7 +38,7 @@ public class DefaultApplicationArgumentsTests { @Test public void argumentsMustNotBeNull() { assertThatIllegalArgumentException() - .isThrownBy(() -> new DefaultApplicationArguments(null)) + .isThrownBy(() -> new DefaultApplicationArguments((String[]) null)) .withMessageContaining("Args must not be null"); }