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 ;
@@ -949,7 +950,11 @@ private boolean checkDeserializer(@Nullable Object deser) {
949950 }
950951 else if (deser instanceof String ) {
951952 try {
952- deserializer = ClassUtils .forName ((String ) deser , getApplicationContext ().getClassLoader ());
953+ ApplicationContext applicationContext = getApplicationContext ();
954+ ClassLoader classLoader = applicationContext == null
955+ ? getClass ().getClassLoader ()
956+ : applicationContext .getClassLoader ();
957+ deserializer = ClassUtils .forName ((String ) deser , classLoader );
953958 }
954959 catch (ClassNotFoundException | LinkageError e ) {
955960 throw new IllegalStateException (e );
You can’t perform that action at this time.
0 commit comments