在我的Spring Boot应用程序中,我配置了两个不同的MQQueueConnectionFactory实例(具有不同的ID),因为这是应用程序的需求。为此,我已经添加了IBM客户端JAR包。
我还在代码中添加了spring-jms依赖项,因为我想使用JmsTemplate等类。添加此依赖项后,JmsAutoConfiguration在类路径中找到JmsTemplate并尝试配置bean。在此过程中,它尝试注入类型为ConnectionFactory的bean,这就是代码失败并开始出现错误的地方。以下是来自JmsAutoConfiguration的代码。
我还在代码中添加了spring-jms依赖项,因为我想使用JmsTemplate等类。添加此依赖项后,JmsAutoConfiguration在类路径中找到JmsTemplate并尝试配置bean。在此过程中,它尝试注入类型为ConnectionFactory的bean,这就是代码失败并开始出现错误的地方。以下是来自JmsAutoConfiguration的代码。
@Configuration
@ConditionalOnClass(JmsTemplate.class)
@ConditionalOnBean(ConnectionFactory.class)
@EnableConfigurationProperties(JmsProperties.class)
@Import(JmsAnnotationDrivenConfiguration.class)
public class JmsAutoConfiguration {
@Autowired
private JmsProperties properties;
@Autowired
private ConnectionFactory connectionFactory;
@Autowired(required = false)
private DestinationResolver destinationResolver;
我是否有办法关闭Spring Boot的JmsAutoconfiguration功能?如果没有,那么有什么替代方案吗?
catalina.out
中看到错误信息Caused by: java.lang.NoSuchMethodException: org.springframework.jms.annotation.JmsBootstrapConfiguration$$EnhancerBySpringCGLIB$$9f8a2d0.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)
,您可以尝试以下解决方案。 - tom_mai78101