我使用 Reactor 2 的 Spring 4 应用程序无法启动:
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'orderHandlerConsumer' could not be injected as a 'fm.data.repository.OrderHandlerConsumer' because it is a JDK dynamic proxy that implements:
reactor.fn.Consumer
Action:
Consider injecting the bean as one of its interfaces or forcing the use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching.
OrderHandlerConsumer
非常简单:
@Service
@Order(Ordered.HIGHEST_PRECEDENCE)
public class OrderHandlerConsumer implements Consumer<Event<OrderEnvelope>> {
@Override
public void accept(Event<OrderEnvelope> event) {
event.getData().getLatch().countDown();
}
}
有什么想法可能会出错吗?
最佳答案
在您将其定义为 Spring 应用程序的应用程序类文件中,在其下方添加。
@SpringBootApplication
@EnableCaching(proxyTargetClass = true)
关于java - 该 bean 无法作为 'Type' 注入(inject),因为它是实现 : reactor. fn.Consumer 的 JDK 动态代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45124660/