Michal
Michal

Reputation: 2273

Using MuleClient in spring boot application

Background

I'm using Mule runtime as an infrastructure component running on a separate server. I want to determine the best practice for implementing a Mule client within my application.

The problem

I'm getting into all sorts of issues trying to use MuleClient within my Spring Boot rest application (via org.mule.modules/mule-module-client/3.8.1 maven dependency):

1) Logging subsystem in mule (log4j) is conflicting with the default of Spring Boot (logback). This can be addressed by switching Spring Boot to log4j (https://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html)

2) Mule Client introduces dependency on org.jgrapht/jgrapht-jdk1.5/0.7.3 which is producing error on startup Ignoring Class-Path entry lib/jgraph.jar found in ...

3) most importantly the spring boot application fails to start with the following error:

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.

if I remove the @EnableCaching annotation from the app, same error manifests itself in another dependency injection:

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.

Questions

1) Any ideas on resolving these errors please?
2) Is it worth using MuleClient in my app (and having access to messages, events, flows, etc...) or should I just fall back to plain HTTP REST client?

Thanks!

Upvotes: 1

Views: 472

Answers (2)

Tim Millhouse
Tim Millhouse

Reputation: 11

If you look in version 3.8.1 of mule-module-spring-config, you'll see they are redefining org.springframework.beans.factory.support.DefaultListableBeanFactory. Something in this class is causing the ObjectProvider exception on startup.

Redefine this class within your project, providing the most recent version of the implementation, and the app will startup without that exception.

Upvotes: 1

Derrops
Derrops

Reputation: 8107

IMHO you are defeating the purpose of an integration platform such as Mule if you go and use the MuleClient. What if another application (which is not Java based) then needs to be integrated? All the work you did with the MuleClient will need to be redone.

I strongly suggest you make your MuleApplication accessible via a REST API, and do not use the MuleClient, as you are sort of leading to in your last point. That's sort of what a micro service architecture is all about and will mean any other application can still be integrated via the REST API, which will be all nicely documented and easy to use because of RAML.

Upvotes: 1

Related Questions