File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 34
34
import org .springframework .format .support .DefaultFormattingConversionService ;
35
35
import org .springframework .http .converter .json .Jackson2ObjectMapperBuilder ;
36
36
import org .springframework .http .converter .support .AllEncompassingFormHttpMessageConverter ;
37
- import org .springframework .util .ClassUtils ;
38
37
39
38
/**
40
39
* {@link ApplicationListener} to trigger early initialization in a background thread of
@@ -101,24 +100,22 @@ private void performPreinitialization() {
101
100
public void run () {
102
101
runSafely (new ConversionServiceInitializer ());
103
102
runSafely (new ValidationInitializer ());
104
- if (ClassUtils .isPresent (
105
- "org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter" ,
106
- BackgroundPreinitializer .class .getClassLoader ())) {
107
- runSafely (new MessageConverterInitializer ());
108
- }
109
- else {
103
+ if (!runSafely (new MessageConverterInitializer ())) {
104
+ // If the MessageConverterInitializer we still might be able to
105
+ // initialize Jackson
110
106
runSafely (new JacksonInitializer ());
111
107
}
112
108
runSafely (new CharsetInitializer ());
113
109
preinitializationComplete .countDown ();
114
110
}
115
111
116
- public void runSafely (Runnable runnable ) {
112
+ boolean runSafely (Runnable runnable ) {
117
113
try {
118
114
runnable .run ();
115
+ return true ;
119
116
}
120
117
catch (Throwable ex ) {
121
- // Ignore
118
+ return false ;
122
119
}
123
120
}
124
121
You can’t perform that action at this time.
0 commit comments