amqphub / amqp-10-jms-spring-boot

AMQP 1.0 JMS Binding for Spring Boot
Apache License 2.0
34 stars 25 forks source link

Hard runtime dependency on org.messaginghub:pooled-jms even though this should be an optional dependency #9

Open klr8 opened 4 years ago

klr8 commented 4 years ago

The pom of the amqp-10-jms-spring-boot-autoconfigure module specifies org.messaginghub:pooled-jms to be an optional dependency.

The fact that this is an optional dependency is carried through in AMQP10JMSAutoConfiguration where you get a pool "@ConditionalOnClass(JmsPoolConnectionFactory.class)". This should work since according to Spring's JavaDoc for ConditionalOnClass: "A {@link #value()} can be safely specified on {@code @Configuration} classes as the annotation metadata is parsed by using ASM before the class is loaded".

However, AMQP10JMSProperties has a plain old dependency on JmsPoolConnectionFactory, causing an error if it's not on the classpath even when pooling is disabled:

Error creating bean with name 'amqphub.amqp10jms-org.amqphub.spring.boot.jms.autoconfigure.AMQP10JMSProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/messaginghub/pooled/jms/JmsPoolConnectionFactory