2015-12-02 101 views
2

您好我有一個彈簧啓動應用程序,它使用Java DSL通過網關接口啓動彈簧集成流程。一切正常自行工作。我加了AOP捕捉到異常,與@EnableAspectJAutoProxy(proxyTargetClass = true)Spring Boot + Spring集成Java DSL + AOP:無法代理網關接口

在這個階段,它給人的錯誤:

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,它的工作原理,但建議不會被觸發。

任何幫助?有沒有辦法在沒有網關的情況下啓動彈簧整合流程?

回答

2

沒有與網關Proxy關聯的類,所以你不能通知它。

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

除了使用網關,聲明MessagingTemplate型豆和使用template.sendAndReceive(someMessage)template.convertSendAndReceive(somePojo)代替。請參閱here

(網關在內部使用MessagingTemplate;網關打開MessagingException並拋出原因,模板沒有)。

它也不支持錯誤通道。

爲了更接近網關功能,您可以繼承MessagingGatewaySupport並調用其sendAndReceive()方法。

+0

好東西!謝謝加里。 – Ocelot