Skip to content

Commit 66f1344

Browse files
committed
Merge branch '2.1.x'
Closes gh-17335 Closes gh-17292
2 parents 867c35a + 91786bc commit 66f1344

File tree

11 files changed

+75
-61
lines changed

11 files changed

+75
-61
lines changed

Diff for: eclipse/spring-boot-project.setup

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<requirement
6060
name="org.eclipse.jdt.feature.group"/>
6161
<requirement
62-
name="io.spring.javaformat.eclipse.feature.feature.group"/>
62+
name="io.spring.javaformat.eclipse.feature.feature.group" versionRange="[0.0.14,0.0.15)"/>
6363
<requirement
6464
name="org.eclipse.jst.server_adapters.feature.feature.group"/>
6565
<requirement

Diff for: pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</property>
2525
</activation>
2626
<properties>
27-
<spring-javaformat.version>0.0.12</spring-javaformat.version>
27+
<spring-javaformat.version>0.0.14</spring-javaformat.version>
2828
<nohttp-checkstyle.version>0.0.1.RELEASE</nohttp-checkstyle.version>
2929
</properties>
3030
<build>
@@ -37,7 +37,7 @@
3737
<dependency>
3838
<groupId>com.puppycrawl.tools</groupId>
3939
<artifactId>checkstyle</artifactId>
40-
<version>8.18</version>
40+
<version>8.22</version>
4141
</dependency>
4242
<dependency>
4343
<groupId>io.spring.javaformat</groupId>

Diff for: spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ class HazelcastAutoConfigurationClientTests {
5050
private static HazelcastInstance hazelcastServer;
5151

5252
@BeforeAll
53-
public static void init() {
53+
static void init() {
5454
hazelcastServer = Hazelcast.newHazelcastInstance();
5555
}
5656

5757
@AfterAll
58-
public static void close() {
58+
static void close() {
5959
if (hazelcastServer != null) {
6060
hazelcastServer.shutdown();
6161
}

Diff for: spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationIntegrationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class KafkaAutoConfigurationIntegrationTests {
5858
private AnnotationConfigApplicationContext context;
5959

6060
@BeforeAll
61-
public static void setUp() {
61+
static void setUp() {
6262
embeddedKafka.afterPropertiesSet();
6363
}
6464

@@ -70,7 +70,7 @@ void close() {
7070
}
7171

7272
@AfterAll
73-
public static void tearDown() {
73+
static void tearDown() {
7474
embeddedKafka.destroy();
7575
}
7676

Diff for: spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,14 @@ void userAgent() throws Exception {
350350
}
351351

352352
private byte[] createFakeZipArchive(String fileName, String content) throws IOException {
353-
try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(bos)) {
354-
ZipEntry entry = new ZipEntry(fileName);
355-
zos.putNextEntry(entry);
356-
zos.write(content.getBytes());
357-
zos.closeEntry();
358-
return bos.toByteArray();
353+
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
354+
try (ZipOutputStream zos = new ZipOutputStream(bos)) {
355+
ZipEntry entry = new ZipEntry(fileName);
356+
zos.putNextEntry(entry);
357+
zos.write(content.getBytes());
358+
zos.closeEntry();
359+
return bos.toByteArray();
360+
}
359361
}
360362
}
361363

Diff for: spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilderTests.java

+53-41
Original file line numberDiff line numberDiff line change
@@ -63,44 +63,53 @@ void hintsOnMaps() throws IOException {
6363

6464
@Test
6565
void severalRepositoriesNoConflict() throws IOException {
66-
try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) {
67-
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar).build();
68-
validateFoo(repo);
69-
validateBar(repo);
70-
assertThat(repo.getAllGroups()).hasSize(2);
71-
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
72-
"spring.bar.name", "spring.bar.description", "spring.bar.counter");
73-
assertThat(repo.getAllProperties()).hasSize(6);
66+
try (InputStream foo = getInputStreamFor("foo")) {
67+
try (InputStream bar = getInputStreamFor("bar")) {
68+
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar)
69+
.build();
70+
validateFoo(repo);
71+
validateBar(repo);
72+
assertThat(repo.getAllGroups()).hasSize(2);
73+
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
74+
"spring.bar.name", "spring.bar.description", "spring.bar.counter");
75+
assertThat(repo.getAllProperties()).hasSize(6);
76+
}
7477
}
7578
}
7679

7780
@Test
7881
void repositoryWithRoot() throws IOException {
79-
try (InputStream foo = getInputStreamFor("foo"); InputStream root = getInputStreamFor("root")) {
80-
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root).build();
81-
validateFoo(repo);
82-
assertThat(repo.getAllGroups()).hasSize(2);
83-
84-
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
85-
"spring.root.name", "spring.root2.name");
86-
assertThat(repo.getAllProperties()).hasSize(5);
82+
try (InputStream foo = getInputStreamFor("foo")) {
83+
try (InputStream root = getInputStreamFor("root")) {
84+
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root)
85+
.build();
86+
validateFoo(repo);
87+
assertThat(repo.getAllGroups()).hasSize(2);
88+
89+
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
90+
"spring.root.name", "spring.root2.name");
91+
assertThat(repo.getAllProperties()).hasSize(5);
92+
}
8793
}
8894
}
8995

9096
@Test
9197
void severalRepositoriesIdenticalGroups() throws IOException {
92-
try (InputStream foo = getInputStreamFor("foo"); InputStream foo2 = getInputStreamFor("foo2")) {
93-
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2).build();
94-
assertThat(repo.getAllGroups()).hasSize(1);
95-
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
96-
contains(group.getSources(), "org.acme.Foo", "org.acme.Foo2", "org.springframework.boot.FooProperties");
97-
assertThat(group.getSources()).hasSize(3);
98-
contains(group.getProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
99-
"spring.foo.enabled", "spring.foo.type");
100-
assertThat(group.getProperties()).hasSize(5);
101-
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
102-
"spring.foo.enabled", "spring.foo.type");
103-
assertThat(repo.getAllProperties()).hasSize(5);
98+
try (InputStream foo = getInputStreamFor("foo")) {
99+
try (InputStream foo2 = getInputStreamFor("foo2")) {
100+
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2)
101+
.build();
102+
assertThat(repo.getAllGroups()).hasSize(1);
103+
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
104+
contains(group.getSources(), "org.acme.Foo", "org.acme.Foo2", "org.springframework.boot.FooProperties");
105+
assertThat(group.getSources()).hasSize(3);
106+
contains(group.getProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
107+
"spring.foo.enabled", "spring.foo.type");
108+
assertThat(group.getProperties()).hasSize(5);
109+
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
110+
"spring.foo.enabled", "spring.foo.type");
111+
assertThat(repo.getAllProperties()).hasSize(5);
112+
}
104113
}
105114
}
106115

@@ -135,19 +144,22 @@ void multiGroups() throws IOException {
135144

136145
@Test
137146
void builderInstancesAreIsolated() throws IOException {
138-
try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) {
139-
ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder.create();
140-
ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build();
141-
validateFoo(firstRepo);
142-
ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build();
143-
validateFoo(secondRepo);
144-
validateBar(secondRepo);
145-
// first repo not impacted by second build
146-
assertThat(secondRepo).isNotEqualTo(firstRepo);
147-
assertThat(firstRepo.getAllGroups()).hasSize(1);
148-
assertThat(firstRepo.getAllProperties()).hasSize(3);
149-
assertThat(secondRepo.getAllGroups()).hasSize(2);
150-
assertThat(secondRepo.getAllProperties()).hasSize(6);
147+
try (InputStream foo = getInputStreamFor("foo")) {
148+
try (InputStream bar = getInputStreamFor("bar")) {
149+
ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder
150+
.create();
151+
ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build();
152+
validateFoo(firstRepo);
153+
ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build();
154+
validateFoo(secondRepo);
155+
validateBar(secondRepo);
156+
// first repo not impacted by second build
157+
assertThat(secondRepo).isNotEqualTo(firstRepo);
158+
assertThat(firstRepo.getAllGroups()).hasSize(1);
159+
assertThat(firstRepo.getAllProperties()).hasSize(3);
160+
assertThat(secondRepo.getAllGroups()).hasSize(2);
161+
assertThat(secondRepo.getAllProperties()).hasSize(6);
162+
}
151163
}
152164
}
153165

Diff for: spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.11")
7+
classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.14")
88
}
99
}
1010

Diff for: spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiOutputTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
class AnsiOutputTests {
3333

3434
@BeforeAll
35-
public static void enable() {
35+
static void enable() {
3636
AnsiOutput.setEnabled(Enabled.ALWAYS);
3737
}
3838

3939
@AfterAll
40-
public static void reset() {
40+
static void reset() {
4141
AnsiOutput.setEnabled(Enabled.DETECT);
4242
}
4343

Diff for: spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/ColorConverterTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ class ColorConverterTests {
4242
private final String in = "in";
4343

4444
@BeforeAll
45-
public static void setupAnsi() {
45+
static void setupAnsi() {
4646
AnsiOutput.setEnabled(AnsiOutput.Enabled.ALWAYS);
4747
}
4848

4949
@AfterAll
50-
public static void resetAnsi() {
50+
static void resetAnsi() {
5151
AnsiOutput.setEnabled(AnsiOutput.Enabled.DETECT);
5252
}
5353

Diff for: spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class RootUriTemplateHandlerTests {
5252

5353
@BeforeEach
5454
@SuppressWarnings("unchecked")
55-
public void setup() throws URISyntaxException {
55+
void setup() throws URISyntaxException {
5656
MockitoAnnotations.initMocks(this);
5757
this.uri = new URI("https://example.com/hello");
5858
this.handler = new RootUriTemplateHandler("https://example.com", this.delegate);

Diff for: spring-boot-tests/spring-boot-integration-tests/spring-boot-configuration-processor-tests/src/test/java/org/springframework/boot/configurationprocessor/tests/ConfigurationProcessorIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ConfigurationProcessorIntegrationTests {
3939
private static ConfigurationMetadataRepository repository;
4040

4141
@BeforeAll
42-
public static void readMetadata() throws IOException {
42+
static void readMetadata() throws IOException {
4343
Resource resource = new ClassPathResource("META-INF/spring-configuration-metadata.json");
4444
assertThat(resource.exists()).isTrue();
4545
// Make sure the right file is detected

0 commit comments

Comments
 (0)