【问题标题】:Using MuleClient in spring boot application在 Spring Boot 应用程序中使用 MuleClient
【发布时间】:2017-06-01 00:09:33
【问题描述】:

背景

我将 Mule 运行时用作在单独服务器上运行的基础架构组件。我想确定在我的应用程序中实现 Mule 客户端的最佳实践。

问题

我在尝试在我的 Spring Boot REST 应用程序中使用 MuleClient 时遇到了各种问题(通过 org.mule.modules/mule-module-client/3.8.1 maven 依赖项):

1) mule (log4j) 中的日志记录子系统与 Spring Boot (logback) 的默认值冲突。这可以通过将 Spring Boot 切换到 log4j (https://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html) 来解决

2) Mule Client 引入了对org.jgrapht/jgrapht-jdk1.5/0.7.3 的依赖,这会在启动时产生错误Ignoring Class-Path entry lib/jgraph.jar found in ...

3) 最重要的是 spring boot 应用启动失败,出现如下错误:

Description:

Parameter 0 of method cacheManagerCustomizers in 
org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration required a bean of type 'org.springframework.beans.factory.ObjectProvider' that could not be found.


Action:

Consider defining a bean of type 
'org.springframework.beans.factory.ObjectProvider' in your configuration.

如果我从应用程序中删除 @EnableCaching 注释,同样的错误会在另一个依赖注入中表现出来:

Parameter 1 of constructor in 
org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration required a bean of type 'org.springframework.beans.factory.ObjectProvider' that could not be found.

问题

1) 请问有解决这些错误的想法吗?
2) 在我的应用程序中使用 MuleClient 是否值得(并且可以访问消息、事件、流等......)还是应该回退到普通的 HTTP REST 客户端?

谢谢!

【问题讨论】:

    标签: java spring spring-boot mule


    【解决方案1】:

    恕我直言,如果您使用 MuleClient,您就违背了 Mule 等集成平台的目的。如果需要集成另一个应用程序(不是基于 Java 的)怎么办?您对 MuleClient 所做的所有工作都需要重做。

    我强烈建议您通过 REST API 使您的 MuleApplication 可访问,并且不要使用 MuleClient,因为您在最后一点中有所引导。这就是微服务架构的全部意义所在,这意味着任何其他应用程序仍然可以通过 REST API 进行集成,由于 RAML,这一切都将得到很好的记录并且易于使用。

    【讨论】:

      【解决方案2】:

      如果您查看 mule-module-spring-config 的 3.8.1 版本,您会发现它们正在重新定义 org.springframework.beans.factory.support.DefaultListableBeanFactory。此类中的某些内容在启动时导致 ObjectProvider 异常。

      在您的项目中重新定义这个类,提供最新版本的实现,应用程序将在没有该异常的情况下启动。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-01-19
        • 2023-03-16
        • 2021-10-24
        • 2019-08-10
        • 2018-09-17
        • 2020-03-17
        • 1970-01-01
        相关资源
        最近更新 更多