diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeBom.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeBom.java index 2e6b417b7da..ee954f397f4 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeBom.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeBom.java @@ -66,7 +66,7 @@ public class UpgradeBom extends DefaultTask { getProject().getRepositories().withType(MavenArtifactRepository.class, (repository) -> { String repositoryUrl = repository.getUrl().toString(); if (!repositoryUrl.endsWith("snapshot")) { - this.repositoryUrls.add(repository.getUrl().toString()); + this.repositoryUrls.add(repositoryUrl); } }); } diff --git a/buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java index 28a32781808..3f28e09e9a2 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java @@ -62,7 +62,7 @@ public class ToolchainPlugin implements Plugin { } } - public boolean isJavaVersionSupported(ToolchainExtension toolchain, JavaLanguageVersion toolchainVersion) { + private boolean isJavaVersionSupported(ToolchainExtension toolchain, JavaLanguageVersion toolchainVersion) { return toolchain.getMaximumCompatibleJavaVersion().map((version) -> version.canCompileOrRun(toolchainVersion)) .getOrElse(true); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointIntegrationTests.java index ca6c9984ba6..03d8f497ae2 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointIntegrationTests.java @@ -27,9 +27,7 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAu import org.springframework.boot.actuate.autoconfigure.web.jersey.JerseySameManagementContextConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration; -import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener; import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration; -import org.springframework.boot.logging.LogLevel; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext; @@ -55,7 +53,6 @@ class JerseyWebEndpointIntegrationTests { JerseyWebEndpointManagementContextConfiguration.class)) .withUserConfiguration(ResourceConfigConfiguration.class) .withClassLoader(new FilteredClassLoader(DispatcherServlet.class)) - .withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO)) .withPropertyValues("spring.jersey.type=filter", "server.port=0").run((context) -> { assertThat(context).hasNotFailed(); Set resources = context.getBean(ResourceConfig.class).getResources(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java index 0416b8b64c6..05200c17fb6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java @@ -55,13 +55,11 @@ import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; -import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfigurationTests.JpaUsingApplicationListenerConfiguration.EventCapturingApplicationListener; import org.springframework.boot.autoconfigure.orm.jpa.mapping.NonAnnotatedEntity; import org.springframework.boot.autoconfigure.orm.jpa.test.City; import org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration; import org.springframework.boot.jdbc.init.DependsOnDataSourceInitialization; -import org.springframework.boot.logging.LogLevel; import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy; import org.springframework.boot.orm.jpa.hibernate.SpringJtaPlatform; import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; @@ -356,8 +354,7 @@ class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigurationTes @Test void eventListenerCanBeRegisteredAsBeans() { - contextRunner().withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO)) - .withUserConfiguration(TestInitializedJpaConfiguration.class) + contextRunner().withUserConfiguration(TestInitializedJpaConfiguration.class) .withClassLoader(new HideDataScriptClassLoader()) .withPropertyValues("spring.jpa.show-sql=true", "spring.jpa.hibernate.ddl-auto:create-drop", "spring.datasource.data:classpath:/city.sql", "spring.jpa.defer-datasource-initialization=true") diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfigurationTests.java index f8782712849..91bbe8a37d3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfigurationTests.java @@ -19,8 +19,6 @@ package org.springframework.boot.autoconfigure.rsocket; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener; -import org.springframework.boot.logging.LogLevel; import org.springframework.boot.rsocket.context.RSocketPortInfoApplicationContextInitializer; import org.springframework.boot.rsocket.context.RSocketServerBootstrap; import org.springframework.boot.rsocket.server.RSocketServerCustomizer; @@ -148,7 +146,6 @@ class RSocketServerAutoConfigurationTests { @Test void whenSpringWebIsNotPresentThenEmbeddedServerConfigurationBacksOff() { contextRunner().withClassLoader(new FilteredClassLoader(ReactorResourceFactory.class)) - .withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO)) .withPropertyValues("spring.rsocket.server.port=0") .run((context) -> assertThat(context).doesNotHaveBean(RSocketServerFactory.class)); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilderTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilderTests.java index fd5dbcd3c19..7a7e9b573bf 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilderTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2021 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. @@ -64,93 +64,77 @@ class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractConfigurat @Test void severalRepositoriesNoConflict() throws IOException { - try (InputStream foo = getInputStreamFor("foo")) { - try (InputStream bar = getInputStreamFor("bar")) { - ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar) - .build(); - validateFoo(repo); - validateBar(repo); - assertThat(repo.getAllGroups()).hasSize(2); - contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter", - "spring.bar.name", "spring.bar.description", "spring.bar.counter"); - assertThat(repo.getAllProperties()).hasSize(6); - } + try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) { + ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar).build(); + validateFoo(repo); + validateBar(repo); + assertThat(repo.getAllGroups()).hasSize(2); + contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter", + "spring.bar.name", "spring.bar.description", "spring.bar.counter"); + assertThat(repo.getAllProperties()).hasSize(6); } } @Test void repositoryWithRoot() throws IOException { - try (InputStream foo = getInputStreamFor("foo")) { - try (InputStream root = getInputStreamFor("root")) { - ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root) - .build(); - validateFoo(repo); - assertThat(repo.getAllGroups()).hasSize(2); + try (InputStream foo = getInputStreamFor("foo"); InputStream root = getInputStreamFor("root")) { + ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root).build(); + validateFoo(repo); + assertThat(repo.getAllGroups()).hasSize(2); - contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter", - "spring.root.name", "spring.root2.name"); - assertThat(repo.getAllProperties()).hasSize(5); - } + contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter", + "spring.root.name", "spring.root2.name"); + assertThat(repo.getAllProperties()).hasSize(5); } } @Test void severalRepositoriesIdenticalGroups() throws IOException { - try (InputStream foo = getInputStreamFor("foo")) { - try (InputStream foo2 = getInputStreamFor("foo2")) { - ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2) - .build(); - Iterable allKeys = Arrays.asList("spring.foo.name", "spring.foo.description", - "spring.foo.counter", "spring.foo.enabled", "spring.foo.type"); - assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys); - assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo"); - ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo"); - assertThat(group.getProperties()).containsOnlyKeys(allKeys); - assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo", "org.acme.Foo2", - "org.springframework.boot.FooProperties"); - assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name", - "spring.foo.description"); - assertThat(group.getSources().get("org.acme.Foo2").getProperties()) - .containsOnlyKeys("spring.foo.enabled", "spring.foo.type"); - assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties()) - .containsOnlyKeys("spring.foo.name", "spring.foo.counter"); - } + try (InputStream foo = getInputStreamFor("foo"); InputStream foo2 = getInputStreamFor("foo2")) { + ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2).build(); + Iterable allKeys = Arrays.asList("spring.foo.name", "spring.foo.description", "spring.foo.counter", + "spring.foo.enabled", "spring.foo.type"); + assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys); + assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo"); + ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo"); + assertThat(group.getProperties()).containsOnlyKeys(allKeys); + assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo", "org.acme.Foo2", + "org.springframework.boot.FooProperties"); + assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name", + "spring.foo.description"); + assertThat(group.getSources().get("org.acme.Foo2").getProperties()).containsOnlyKeys("spring.foo.enabled", + "spring.foo.type"); + assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties()) + .containsOnlyKeys("spring.foo.name", "spring.foo.counter"); } } @Test void severalRepositoriesIdenticalGroupsWithSameType() throws IOException { - try (InputStream foo = getInputStreamFor("foo")) { - try (InputStream foo3 = getInputStreamFor("foo3")) { - ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3) - .build(); - Iterable allKeys = Arrays.asList("spring.foo.name", "spring.foo.description", - "spring.foo.counter", "spring.foo.enabled", "spring.foo.type"); - assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys); - assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo"); - ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo"); - assertThat(group.getProperties()).containsOnlyKeys(allKeys); - assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo", - "org.springframework.boot.FooProperties"); - assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name", - "spring.foo.description", "spring.foo.enabled", "spring.foo.type"); - assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties()) - .containsOnlyKeys("spring.foo.name", "spring.foo.counter"); - } + try (InputStream foo = getInputStreamFor("foo"); InputStream foo3 = getInputStreamFor("foo3")) { + ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3).build(); + Iterable allKeys = Arrays.asList("spring.foo.name", "spring.foo.description", "spring.foo.counter", + "spring.foo.enabled", "spring.foo.type"); + assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys); + assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo"); + ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo"); + assertThat(group.getProperties()).containsOnlyKeys(allKeys); + assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo", "org.springframework.boot.FooProperties"); + assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name", + "spring.foo.description", "spring.foo.enabled", "spring.foo.type"); + assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties()) + .containsOnlyKeys("spring.foo.name", "spring.foo.counter"); } } @Test void severalRepositoriesIdenticalGroupsWithSameTypeDoesNotOverrideSource() throws IOException { - try (InputStream foo = getInputStreamFor("foo")) { - try (InputStream foo3 = getInputStreamFor("foo3")) { - ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3) - .build(); - ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo"); - ConfigurationMetadataSource fooSource = group.getSources().get("org.acme.Foo"); - assertThat(fooSource.getSourceMethod()).isEqualTo("foo()"); - assertThat(fooSource.getDescription()).isEqualTo("This is Foo."); - } + try (InputStream foo = getInputStreamFor("foo"); InputStream foo3 = getInputStreamFor("foo3")) { + ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3).build(); + ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo"); + ConfigurationMetadataSource fooSource = group.getSources().get("org.acme.Foo"); + assertThat(fooSource.getSourceMethod()).isEqualTo("foo()"); + assertThat(fooSource.getDescription()).isEqualTo("This is Foo."); } } @@ -185,22 +169,19 @@ class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractConfigurat @Test void builderInstancesAreIsolated() throws IOException { - try (InputStream foo = getInputStreamFor("foo")) { - try (InputStream bar = getInputStreamFor("bar")) { - ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder - .create(); - ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build(); - validateFoo(firstRepo); - ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build(); - validateFoo(secondRepo); - validateBar(secondRepo); - // first repo not impacted by second build - assertThat(secondRepo).isNotEqualTo(firstRepo); - assertThat(firstRepo.getAllGroups()).hasSize(1); - assertThat(firstRepo.getAllProperties()).hasSize(3); - assertThat(secondRepo.getAllGroups()).hasSize(2); - assertThat(secondRepo.getAllProperties()).hasSize(6); - } + try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) { + ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder.create(); + ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build(); + validateFoo(firstRepo); + ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build(); + validateFoo(secondRepo); + validateBar(secondRepo); + // first repo not impacted by second build + assertThat(secondRepo).isNotEqualTo(firstRepo); + assertThat(firstRepo.getAllGroups()).hasSize(1); + assertThat(firstRepo.getAllProperties()).hasSize(3); + assertThat(secondRepo.getAllGroups()).hasSize(2); + assertThat(secondRepo.getAllProperties()).hasSize(6); } } diff --git a/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/TomEEDeploymentIntegrationTests.java b/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/TomEEDeploymentIntegrationTests.java index f96aaa96a55..a04caff1aae 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/TomEEDeploymentIntegrationTests.java +++ b/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/TomEEDeploymentIntegrationTests.java @@ -25,7 +25,7 @@ import org.testcontainers.junit.jupiter.Testcontainers; * @author Christoph Dreis */ @Testcontainers(disabledWithoutDocker = true) -public class TomEEDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests { +class TomEEDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests { @Container static WarDeploymentContainer container = new WarDeploymentContainer("tomee:8-jre-8.0.2-webprofile", diff --git a/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/TomcatDeploymentIntegrationTests.java b/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/TomcatDeploymentIntegrationTests.java index 3957d44a2b6..4585b4bd46b 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/TomcatDeploymentIntegrationTests.java +++ b/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/TomcatDeploymentIntegrationTests.java @@ -25,7 +25,7 @@ import org.testcontainers.junit.jupiter.Testcontainers; * @author Christoph Dreis */ @Testcontainers(disabledWithoutDocker = true) -public class TomcatDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests { +class TomcatDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests { @Container static WarDeploymentContainer container = new WarDeploymentContainer("tomcat:9.0.37-jdk8-openjdk", diff --git a/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/WildflyDeploymentIntegrationTests.java b/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/WildflyDeploymentIntegrationTests.java index 1f8daebc4ad..cf60688af55 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/WildflyDeploymentIntegrationTests.java +++ b/spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/WildflyDeploymentIntegrationTests.java @@ -25,7 +25,7 @@ import org.testcontainers.junit.jupiter.Testcontainers; * @author Christoph Dreis */ @Testcontainers(disabledWithoutDocker = true) -public class WildflyDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests { +class WildflyDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests { @Container static WarDeploymentContainer container = new WarDeploymentContainer("jboss/wildfly:20.0.1.Final",