diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/netty/NettyProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/netty/NettyProperties.java index 1f381468a303..de058a102ab0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/netty/NettyProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/netty/NettyProperties.java @@ -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 @@ 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 = LeakDetection.SIMPLE; + private LeakDetection leakDetection; public LeakDetection getLeakDetection() { return this.leakDetection; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 96a7ee166260..92b781b88ddb 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1862,10 +1862,6 @@ "name": "spring.neo4j.uri", "defaultValue": "bolt://localhost:7687" }, - { - "name": "spring.netty.leak-detection", - "defaultValue": "simple" - }, { "name": "spring.quartz.jdbc.comment-prefix", "defaultValue": [ diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/netty/NettyPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/netty/NettyPropertiesTests.java index df23a8ecb18d..711eab081e3b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/netty/NettyPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/netty/NettyPropertiesTests.java @@ -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. @@ -32,11 +32,10 @@ class NettyPropertiesTests { @Test - void defaultValueShouldMatchNettys() { - NettyProperties properties = new NettyProperties(); + void defaultValueShouldBeConsistent() { ResourceLeakDetector.Level defaultLevel = (Level) ReflectionTestUtils.getField(ResourceLeakDetector.class, "DEFAULT_LEVEL"); - assertThat(ResourceLeakDetector.Level.valueOf(properties.getLeakDetection().name())).isEqualTo(defaultLevel); + assertThat(defaultLevel).isEqualTo(Level.SIMPLE); } }