Skip to content

Commit bf17f50

Browse files
committed
Align NettyProperties with Netty's defaults
Prior to this commit, `NettyProperties` would use `DISABLED` as the default level for leak detection in Netty. This is not the default value enforced by Netty, which is `SIMPLE`. This commit changes the default configuration property value and ensures that both stay in sync. Fixes gh-27046
1 parent 01f8cb7 commit bf17f50

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class NettyProperties {
3232
/**
3333
* Level of leak detection for reference-counted buffers.
3434
*/
35-
private LeakDetection leakDetection = LeakDetection.DISABLED;
35+
private LeakDetection leakDetection = LeakDetection.SIMPLE;
3636

3737
public LeakDetection getLeakDetection() {
3838
return this.leakDetection;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2012-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.autoconfigure.netty;
18+
19+
import io.netty.util.ResourceLeakDetector;
20+
import org.junit.jupiter.api.Test;
21+
22+
import static org.assertj.core.api.Assertions.assertThat;
23+
24+
/**
25+
* Tests for {@link NettyProperties}
26+
*
27+
* @author Brian Clozel
28+
*/
29+
class NettyPropertiesTests {
30+
31+
@Test
32+
void defaultValueShouldMatchNettys() {
33+
NettyProperties properties = new NettyProperties();
34+
assertThat(ResourceLeakDetector.Level.valueOf(properties.getLeakDetection().name()))
35+
.isEqualTo(ResourceLeakDetector.getLevel());
36+
}
37+
38+
}

0 commit comments

Comments
 (0)