File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
spring-kafka/src/main/java/org/springframework/kafka/listener Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 6767import org .apache .kafka .common .header .internals .RecordHeader ;
6868
6969import org .springframework .beans .BeanUtils ;
70+ import org .springframework .context .ApplicationContext ;
7071import org .springframework .core .log .LogAccessor ;
7172import org .springframework .core .task .SimpleAsyncTaskExecutor ;
7273import org .springframework .kafka .KafkaException ;
@@ -939,7 +940,11 @@ private boolean checkDeserializer(@Nullable Object deser) {
939940 }
940941 else if (deser instanceof String ) {
941942 try {
942- deserializer = ClassUtils .forName ((String ) deser , getApplicationContext ().getClassLoader ());
943+ ApplicationContext applicationContext = getApplicationContext ();
944+ ClassLoader classLoader = applicationContext == null
945+ ? getClass ().getClassLoader ()
946+ : applicationContext .getClassLoader ();
947+ deserializer = ClassUtils .forName ((String ) deser , classLoader );
943948 }
944949 catch (ClassNotFoundException | LinkageError e ) {
945950 throw new IllegalStateException (e );
You can’t perform that action at this time.
0 commit comments