Commit 92d1c612 authored by Stephane Nicoll's avatar Stephane Nicoll

Harmonize `accesslog.enabled` flag for Undertow

Closes gh-12178
parent 09ff815f
...@@ -1058,7 +1058,7 @@ public class ServerProperties { ...@@ -1058,7 +1058,7 @@ public class ServerProperties {
/** /**
* Whether to enable the access log. * Whether to enable the access log.
*/ */
private Boolean enabled; private boolean enabled = false;
/** /**
* Format pattern for access logs. * Format pattern for access logs.
...@@ -1085,11 +1085,11 @@ public class ServerProperties { ...@@ -1085,11 +1085,11 @@ public class ServerProperties {
*/ */
private boolean rotate = true; private boolean rotate = true;
public Boolean getEnabled() { public boolean isEnabled() {
return this.enabled; return this.enabled;
} }
public void setEnabled(Boolean enabled) { public void setEnabled(boolean enabled) {
this.enabled = enabled; this.enabled = enabled;
} }
......
...@@ -69,7 +69,7 @@ public class UndertowWebServerFactoryCustomizer implements ...@@ -69,7 +69,7 @@ public class UndertowWebServerFactoryCustomizer implements
.to(factory::setWorkerThreads); .to(factory::setWorkerThreads);
propertyMapper.from(undertowProperties::getDirectBuffers) propertyMapper.from(undertowProperties::getDirectBuffers)
.to(factory::setUseDirectBuffers); .to(factory::setUseDirectBuffers);
propertyMapper.from(accesslogProperties::getEnabled) propertyMapper.from(accesslogProperties::isEnabled)
.to(factory::setAccessLogEnabled); .to(factory::setAccessLogEnabled);
propertyMapper.from(accesslogProperties::getDir) propertyMapper.from(accesslogProperties::getDir)
.to(factory::setAccessLogDirectory); .to(factory::setAccessLogDirectory);
......
...@@ -29,9 +29,7 @@ import org.springframework.boot.web.embedded.undertow.ConfigurableUndertowWebSer ...@@ -29,9 +29,7 @@ import org.springframework.boot.web.embedded.undertow.ConfigurableUndertowWebSer
import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockEnvironment;
import org.springframework.test.context.support.TestPropertySourceUtils; import org.springframework.test.context.support.TestPropertySourceUtils;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
/** /**
...@@ -102,14 +100,6 @@ public class UndertowWebServerFactoryCustomizerTests { ...@@ -102,14 +100,6 @@ public class UndertowWebServerFactoryCustomizerTests {
verify(factory).setUseForwardHeaders(true); verify(factory).setUseForwardHeaders(true);
} }
@Test
public void skipNullElementsForUndertow() {
ConfigurableUndertowWebServerFactory factory = mock(
ConfigurableUndertowWebServerFactory.class);
this.customizer.customize(factory);
verify(factory, never()).setAccessLogEnabled(anyBoolean());
}
private void bind(String... inlinedProperties) { private void bind(String... inlinedProperties) {
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment,
inlinedProperties); inlinedProperties);
......
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