Commit bd2cc6f4 authored by Stephane Nicoll's avatar Stephane Nicoll

Add missing condition on LogFile endpoint

See gh-16298
parent 0bd2e40d
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.logging; package org.springframework.boot.actuate.autoconfigure.logging;
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
import org.springframework.boot.actuate.logging.LogFileWebEndpoint; import org.springframework.boot.actuate.logging.LogFileWebEndpoint;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionMessage;
...@@ -38,6 +39,7 @@ import org.springframework.util.StringUtils; ...@@ -38,6 +39,7 @@ import org.springframework.util.StringUtils;
* @since 2.0.0 * @since 2.0.0
*/ */
@Configuration @Configuration
@ConditionalOnEnabledEndpoint(endpoint = LogFileWebEndpoint.class)
@EnableConfigurationProperties(LogFileWebEndpointProperties.class) @EnableConfigurationProperties(LogFileWebEndpointProperties.class)
public class LogFileWebEndpointAutoConfiguration { public class LogFileWebEndpointAutoConfiguration {
......
/* /*
* Copyright 2012-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -74,7 +74,7 @@ public class LogFileWebEndpointAutoConfigurationTests { ...@@ -74,7 +74,7 @@ public class LogFileWebEndpointAutoConfigurationTests {
.withPropertyValues("logging.file:test.log", .withPropertyValues("logging.file:test.log",
"management.endpoint.logfile.enabled:false") "management.endpoint.logfile.enabled:false")
.run((context) -> assertThat(context) .run((context) -> assertThat(context)
.hasSingleBean(LogFileWebEndpoint.class)); .doesNotHaveBean(LogFileWebEndpoint.class));
} }
@Test @Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment