Skip to content

Commit bd2cc6f

Browse files
committed
Add missing condition on LogFile endpoint
See gh-16298
1 parent 0bd2e40 commit bd2cc6f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/logging/LogFileWebEndpointAutoConfiguration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2019 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.
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.logging;
1818

19+
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
1920
import org.springframework.boot.actuate.logging.LogFileWebEndpoint;
2021
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
2122
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -38,6 +39,7 @@
3839
* @since 2.0.0
3940
*/
4041
@Configuration
42+
@ConditionalOnEnabledEndpoint(endpoint = LogFileWebEndpoint.class)
4143
@EnableConfigurationProperties(LogFileWebEndpointProperties.class)
4244
public class LogFileWebEndpointAutoConfiguration {
4345

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/logging/LogFileWebEndpointAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 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.
@@ -74,7 +74,7 @@ public void logFileWebEndpointCanBeDisabled() {
7474
.withPropertyValues("logging.file:test.log",
7575
"management.endpoint.logfile.enabled:false")
7676
.run((context) -> assertThat(context)
77-
.hasSingleBean(LogFileWebEndpoint.class));
77+
.doesNotHaveBean(LogFileWebEndpoint.class));
7878
}
7979

8080
@Test

0 commit comments

Comments
 (0)