Polish "Allow Netty default leak detection to be overidden"

See gh-32144
pull/32501/head
Stephane Nicoll 2 years ago
parent 51f2e40c69
commit 7f2d4fceec

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -30,9 +30,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
public class NettyProperties {
/**
* Level of leak detection for reference-counted buffers.
* Level of leak detection for reference-counted buffers. If not configured via
* 'ResourceLeakDetector.setLevel' or the 'io.netty.leakDetection.level' system
* property, default to 'simple'.
*/
private LeakDetection leakDetection = null;
private LeakDetection leakDetection;
public LeakDetection getLeakDetection() {
return this.leakDetection;

@ -1736,11 +1736,6 @@
"name": "spring.neo4j.uri",
"defaultValue": "bolt://localhost:7687"
},
{
"name": "spring.netty.leak-detection",
"description": "When null, fall back to Netty system default 'simple' or value of -Dio.netty.leakDetection.level. When set, this will overrride value of -Dio.netty.leakDetection.level",
"defaultValue": "null"
},
{
"name": "spring.quartz.jdbc.comment-prefix",
"defaultValue": [

@ -0,0 +1,41 @@
/*
* Copyright 2012-2022 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.netty;
import io.netty.util.ResourceLeakDetector;
import io.netty.util.ResourceLeakDetector.Level;
import org.junit.jupiter.api.Test;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link NettyProperties}
*
* @author Brian Clozel
*/
class NettyPropertiesTests {
@Test
void defaultValueShouldBeConsistent() {
ResourceLeakDetector.Level defaultLevel = (Level) ReflectionTestUtils.getField(ResourceLeakDetector.class,
"DEFAULT_LEVEL");
assertThat(defaultLevel).isEqualTo(Level.SIMPLE);
}
}
Loading…
Cancel
Save