我正在使用Spring创建一个使用的项目。
我设置了以下属性:
spring.activemq.broker-url=tcp://127.0.0.1:35000 spring.activemq.pooled=true
它工作得很好,但我无法控制连接池的属性。例如,我希望在连接池中设置最大连接数。
有办法设置它吗?
如果我试图自己在Spring xml文件中配置ActiveMq,Spring就会抱怨自动装配2 ConnectionFactory有问题!
有没有办法告诉Spring不要自动配置任何ActiveMq连接工厂?(由ActiveMQConnectionFactoryConfiguration在spring-boot-autoconfigure库中完成)
发布于 2014-09-22 19:43:12
您所需要做的就是提供一个类型为javax.jms.ConnectionFactory的bean,并指示Spring不要提供默认的bean。
代码看起来应该是:
@Configuration
class YourActiveMQConnectionFactoryConfiguration {
@Bean
public ConnectionFactory jmsConnectionFactory() {
return createFactory(); //do whatever you need to here
}
}在您的主应用程序配置类中,向@EnableAutoConfiguration添加排除属性。
@Configuration
@EnableAutoConfiguration(exclude=ActiveMQConnectionFactoryConfiguration.class)
//the rest of your annotations
public class AppConfig {
//declare whatever other beans you need
}https://stackoverflow.com/questions/25981660
复制相似问题