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