Я пытаюсь интегрировать библиотеку, основанную на облачном потоке с весенней загрузкой, с Kafka в приложении, отличном от Spring.
Когда эта библиотека загружается в другое приложение Spring, все работает.
Когда я пытаюсь инициализировать контекст приложения с помощью приложения с включенной загрузкой без использования Spring и получаю свой bean-компонент, я получаю следующие предупреждения и исключения:
org.springframework.core.LocalVariableTableParameterNameDiscoverer - Cannot find '.class' file for class [class com.acme.common.library.spring.service.InstrumentIdLookupServiceImpl$$EnhancerBySpringCGLIB$$59e4e4ac] - unable to determine constructor/method parameter names
org.springframework.beans.factory.support.DefaultListableBeanFactory - Autowiring by type from bean name 'instrumentIdLookupServiceImpl' via constructor to bean named 'instrumentIdLookupServiceProperties'
WARN org.springframework.context.support.GenericApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.acme.common.library.spring.InstrumentIdBinding': Invocation of init method failed; nested exception is java.lang.IllegalStateException: No factory found for binding target type: org.apache.kafka.streams.kstream.KStream among registered factories: channelFactory,messageSourceFactory
No factory found for binding target type: org.apache.kafka.streams.kstream.KStream among registered factories: channelFactory,messageSourceFactory
public interface InstrumentIdBinding {
String INSTRUMENT_IDS = "instrument-ids";
@Input(INSTRUMENT_IDS)
KStream<String, InstrumentIdMsg> processInstrumentId();
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="com.acme.common.library.spring"/>
</beans>
GenericApplicationContext ctx = new GenericApplicationContext();
final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
xmlReader.loadBeanDefinitions(new FileSystemResource("applicationContext-ext.xml"));
ctx.refresh();
InstrumentIdLookupService bean = ctx.getBean(InstrumentIdLookupService.class);