I'm preparing to upgrade spring-boot 3.2.0 and spring-cloud 2023.0.0 for my preview demo, which is a demo abou spring-cloud-stream-binder-kafka and spring-cloud-stream-binder-kafka-streams. Here it's my demo. https://github.com/SingKS8/kafka-stream-demo
I updated spring-boot from 3.1.5 to 3.2.0-RC2, and spring-cloud from 2022.0.4 to 2023.0.0-RC1 (spring cloud stream 4.1.0-RC1).
I find that if I use a @Configuration or @Component class to define beans for functions about ktable or kstream, like the code UserFunction in my demo, I would get this exception.
2023-11-07T22:32:40.554+08:00 ERROR 39485 --- [kafka-stream-demo] [ restartedMain] .f.KafkaStreamsFunctionBeanPostProcessor : Function activation issues while mapping the function: userProcessor
java.lang.ClassCastException: class org.springframework.core.type.classreading.SimpleMethodMetadata cannot be cast to class org.springframework.core.type.StandardMethodMetadata (org.springframework.core.type.classreading.SimpleMethodMetadata and org.springframework.core.type.StandardMethodMetadata are in unnamed module of loader 'app')
at org.springframework.cloud.stream.binder.kafka.streams.function.KafkaStreamsFunctionBeanPostProcessor.extractResolvableTypes(KafkaStreamsFunctionBeanPostProcessor.java:191) ~[spring-cloud-stream-binder-kafka-streams-4.1.0-RC1.jar:4.1.0-RC1]
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) ~[na:na]
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[na:na]
at org.springframework.cloud.stream.binder.kafka.streams.function.KafkaStreamsFunctionBeanPostProcessor.afterPropertiesSet(KafkaStreamsFunctionBeanPostProcessor.java:114) ~[spring-cloud-stream-binder-kafka-streams-4.1.0-RC1.jar:4.1.0-RC1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1822) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1771) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1441) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1348) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:546) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1166) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:563) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:946) ~[spring-context-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.1.0-RC2.jar:6.1.0-RC2]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.0-RC2.jar:3.2.0-RC2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:748) ~[spring-boot-3.2.0-RC2.jar:3.2.0-RC2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:450) ~[spring-boot-3.2.0-RC2.jar:3.2.0-RC2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) ~[spring-boot-3.2.0-RC2.jar:3.2.0-RC2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1336) ~[spring-boot-3.2.0-RC2.jar:3.2.0-RC2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1325) ~[spring-boot-3.2.0-RC2.jar:3.2.0-RC2]
at xyz.opcal.demo.KafkaStreamDemoApplication.main(KafkaStreamDemoApplication.java:23) ~[classes/:na]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.2.0-RC2.jar:3.2.0-RC2]
And the instresting thing is that if I move the code in @Configuration class to @SpringBootApplication class, like "spring-tips" done, I won't get this issue.
My original demo is spring-boot 3.1.5 and spring-cloud 2022.0.4, and it is running successfully, So you cloud downgrade my demo dependencies to debug what is different.
I'm preparing to upgrade spring-boot 3.2.0 and spring-cloud 2023.0.0 for my preview demo, which is a demo abou
spring-cloud-stream-binder-kafkaandspring-cloud-stream-binder-kafka-streams. Here it's my demo. https://github.com/SingKS8/kafka-stream-demoI updated spring-boot from 3.1.5 to 3.2.0-RC2, and spring-cloud from 2022.0.4 to 2023.0.0-RC1 (spring cloud stream 4.1.0-RC1).
I find that if I use a
@Configurationor@Componentclass to define beans for functions aboutktableorkstream, like the codeUserFunctionin my demo, I would get this exception.And the instresting thing is that if I move the code in
@Configurationclass to@SpringBootApplicationclass, like "spring-tips" done, I won't get this issue.My original demo is spring-boot 3.1.5 and spring-cloud 2022.0.4, and it is running successfully, So you cloud downgrade my demo dependencies to debug what is different.