Skip to content

Commit 463766f

Browse files
committed
Merge pull request spring-projects#32144 from russellyou
* pr/32144: Polish "Allow Netty default leak detection to be overidden" Allow Netty default leak detection to be overidden Closes spring-projectsgh-32144
2 parents 6d80b60 + 7f2d4fc commit 463766f

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/netty/NettyProperties.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,9 +30,11 @@
3030
public class NettyProperties {
3131

3232
/**
33-
* Level of leak detection for reference-counted buffers.
33+
* Level of leak detection for reference-counted buffers. If not configured via
34+
* 'ResourceLeakDetector.setLevel' or the 'io.netty.leakDetection.level' system
35+
* property, default to 'simple'.
3436
*/
35-
private LeakDetection leakDetection = LeakDetection.SIMPLE;
37+
private LeakDetection leakDetection;
3638

3739
public LeakDetection getLeakDetection() {
3840
return this.leakDetection;

spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,10 +1736,6 @@
17361736
"name": "spring.neo4j.uri",
17371737
"defaultValue": "bolt://localhost:7687"
17381738
},
1739-
{
1740-
"name": "spring.netty.leak-detection",
1741-
"defaultValue": "simple"
1742-
},
17431739
{
17441740
"name": "spring.quartz.jdbc.comment-prefix",
17451741
"defaultValue": [

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/netty/NettyPropertiesTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,11 +32,10 @@
3232
class NettyPropertiesTests {
3333

3434
@Test
35-
void defaultValueShouldMatchNettys() {
36-
NettyProperties properties = new NettyProperties();
35+
void defaultValueShouldBeConsistent() {
3736
ResourceLeakDetector.Level defaultLevel = (Level) ReflectionTestUtils.getField(ResourceLeakDetector.class,
3837
"DEFAULT_LEVEL");
39-
assertThat(ResourceLeakDetector.Level.valueOf(properties.getLeakDetection().name())).isEqualTo(defaultLevel);
38+
assertThat(defaultLevel).isEqualTo(Level.SIMPLE);
4039
}
4140

4241
}

0 commit comments

Comments
 (0)