spring-boot - Spring Boot + Spring 集成 Java DSL + AOP : Fails to proxy the Gateway interface

标签 spring-boot spring-integration aop spring-aop gateway

嗨,我有一个 Spring Boot 应用程序,它使用 Java DSL 通过网关接口(interface)启动 Spring 集成流程。一切都可以正常运行。我添加了 AOP 来捕获异常,使用 @EnableAspectJAutoProxy(proxyTargetClass = true)

在这个阶段,它给出了错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobInitiator': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.sun.proxy.$Proxy54]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy54

当我删除 proxyTargetClass = true 时,它可以工作,但不会触发建议。

有什么帮助吗?有没有办法在没有网关的情况下启动 spring 集成流程?

最佳答案

没有与网关Proxy关联的类,因此您无法建议它。

Is there a way to start the spring integration flow without a gateway?

不使用网关,而是声明 MessagingTemplate 类型的 Bean 并使用 template.sendAndReceive(someMessage)template.convertSendAndReceive(somePojo) 相反。请参阅here .

(网关在内部使用 MessagingTemplate;网关解包 MessagingException 并抛出原因,而模板则不会)。

它也不支持错误 channel 。

要更接近网关功能,您可以子类化 MessagingGatewaySupport 并调用其 sendAndReceive() 方法。

关于spring-boot - Spring Boot + Spring 集成 Java DSL + AOP : Fails to proxy the Gateway interface,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34035369/

相关文章:

spring-integration - Spring Cloud Stream有没有SNS模块

java - 是否可以在编译时将 AspectJ 编织到 WAR 打包项目中?

spring-boot - 带有嵌入式tomcat的Spring Boot在临时文件夹中创建空目录

java - 无法在文件 :inbound-channel-adapter and scanner? 中设置不同的过滤器

java - Spring:如何使用注释配置 Messaging Bridge 轮询器

php - Flow3调试

java - 如何配置aspectj忽略getter和setter

spring-boot - Spring Boot : separate REST from static content

spring-boot - java.io.FileNotFoundException :/BOOT-inf/classes!/templates/

java - 更新字符串字段,将 mongodb 中的另一个字符串与 spring-data 连接起来