spring-cloud-sleuth: Unable to wire TopicConnectionFactory Beans, since they get wrapped by LazyConnectionFactory

Dear Spring Cloud Team,

Since Version 2.1.0 the class TracingConnectionFactoryBeanPostProcessor wraps any javax.jms.ConnectionFactory into a LazyConnectionFactory.

This creates an issue when autowiring beans of type javax.jms.TopicConnectionFactory, since any TopicConnectionFactory gets wrapped in a LazyConnectionFactory (Check LazyConnectionFactory:78).

But since the LazyConnectionFactory is not assignable to TopicConnectionFactory the following exception is thrown during the wiring process:

Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'activeMqConnectionFactory' is expected to be of type 'javax.jms.TopicConnectionFactory' but was actually of type 'org.springframework.cloud.sleuth.instrument.messaging.LazyConnectionFactory'
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1257)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760)
	... 51 common frames omitted```

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 20 (6 by maintainers)

Most upvoted comments

Problem is solved in the latest snapshot build.