diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java index 523bebab482c..8bdc8c798cc8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java @@ -100,18 +100,22 @@ private void performPreinitialization() { public void run() { runSafely(new ConversionServiceInitializer()); runSafely(new ValidationInitializer()); - runSafely(new MessageConverterInitializer()); - runSafely(new JacksonInitializer()); + if (!runSafely(new MessageConverterInitializer())) { + // If the MessageConverterInitializer we still might be able to + // initialize Jackson + runSafely(new JacksonInitializer()); + } runSafely(new CharsetInitializer()); preinitializationComplete.countDown(); } - public void runSafely(Runnable runnable) { + boolean runSafely(Runnable runnable) { try { runnable.run(); + return true; } catch (Throwable ex) { - // Ignore + return false; } }