Add background preinitializers for Tomcat and JDK ZoneId

Closes gh-37670
pull/37640/head
Phillip Webb 1 year ago
parent fd9b2b114e
commit 560527945b

@ -17,11 +17,14 @@
package org.springframework.boot.autoconfigure; package org.springframework.boot.autoconfigure;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.ZoneId;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import jakarta.validation.Configuration; import jakarta.validation.Configuration;
import jakarta.validation.Validation; import jakarta.validation.Validation;
import org.apache.catalina.authenticator.NonLoginAuthenticator;
import org.apache.tomcat.util.http.Rfc6265CookieProcessor;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.boot.context.event.ApplicationFailedEvent; import org.springframework.boot.context.event.ApplicationFailedEvent;
@ -107,6 +110,8 @@ public class BackgroundPreinitializer implements ApplicationListener<SpringAppli
runSafely(new JacksonInitializer()); runSafely(new JacksonInitializer());
} }
runSafely(new CharsetInitializer()); runSafely(new CharsetInitializer());
runSafely(new TomcatInitializer());
runSafely(new JdkInitializer());
preinitializationComplete.countDown(); preinitializationComplete.countDown();
} }
@ -189,4 +194,23 @@ public class BackgroundPreinitializer implements ApplicationListener<SpringAppli
} }
private static class TomcatInitializer implements Runnable {
@Override
public void run() {
new Rfc6265CookieProcessor();
new NonLoginAuthenticator();
}
}
private static class JdkInitializer implements Runnable {
@Override
public void run() {
ZoneId.systemDefault();
}
}
} }

Loading…
Cancel
Save