parent
f3a138da16
commit
43345b36e6
|
@ -54,7 +54,7 @@ public abstract class AbstractDependsOnBeanFactoryPostProcessor implements BeanF
|
||||||
private final Function<ListableBeanFactory, Set<String>> dependsOn;
|
private final Function<ListableBeanFactory, Set<String>> dependsOn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an instance with target bean and factory bean classes and dependency names.
|
* Create an instance with target bean, factory bean classes, and dependency names.
|
||||||
* @param beanClass target bean class
|
* @param beanClass target bean class
|
||||||
* @param factoryBeanClass target factory bean class
|
* @param factoryBeanClass target factory bean class
|
||||||
* @param dependsOn dependency names
|
* @param dependsOn dependency names
|
||||||
|
@ -67,7 +67,7 @@ public abstract class AbstractDependsOnBeanFactoryPostProcessor implements BeanF
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an instance with target bean and factory bean classes and dependency types.
|
* Create an instance with target bean, factory bean classes, and dependency types.
|
||||||
* @param beanClass target bean class
|
* @param beanClass target bean class
|
||||||
* @param factoryBeanClass target factory bean class
|
* @param factoryBeanClass target factory bean class
|
||||||
* @param dependencyTypes dependency types
|
* @param dependencyTypes dependency types
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class MongoClientDependsOnBeanFactoryPostProcessor extends AbstractDepend
|
||||||
* dependencies upon beans with the given names.
|
* dependencies upon beans with the given names.
|
||||||
* @param dependsOn names of the beans to depend upon
|
* @param dependsOn names of the beans to depend upon
|
||||||
* @deprecated since 2.1.7 in favor of
|
* @deprecated since 2.1.7 in favor of
|
||||||
* {@link #MongoClientDependsOnBeanFactoryPostProcessor}
|
* {@link #MongoClientDependsOnBeanFactoryPostProcessor(Class...)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public MongoClientDependsOnBeanFactoryPostProcessor(String... dependsOn) {
|
public MongoClientDependsOnBeanFactoryPostProcessor(String... dependsOn) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor
|
||||||
* that will set up dependencies upon beans with the given names.
|
* that will set up dependencies upon beans with the given names.
|
||||||
* @param dependsOn names of the beans to depend upon
|
* @param dependsOn names of the beans to depend upon
|
||||||
* @deprecated since 2.1.7 in favor of
|
* @deprecated since 2.1.7 in favor of
|
||||||
* {@link #ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor}
|
* {@link #ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor(Class...)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor(String... dependsOn) {
|
public ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor(String... dependsOn) {
|
||||||
|
|
|
@ -56,6 +56,11 @@ class ActiveMQConnectionFactoryConfiguration {
|
||||||
@ConditionalOnProperty(prefix = "spring.jms.cache", name = "enabled", havingValue = "false")
|
@ConditionalOnProperty(prefix = "spring.jms.cache", name = "enabled", havingValue = "false")
|
||||||
ActiveMQConnectionFactory jmsConnectionFactory(ActiveMQProperties properties,
|
ActiveMQConnectionFactory jmsConnectionFactory(ActiveMQProperties properties,
|
||||||
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
|
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
|
||||||
|
return createJmsConnectionFactory(properties, factoryCustomizers);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActiveMQConnectionFactory createJmsConnectionFactory(ActiveMQProperties properties,
|
||||||
|
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
|
||||||
return new ActiveMQConnectionFactoryFactory(properties,
|
return new ActiveMQConnectionFactoryFactory(properties,
|
||||||
factoryCustomizers.orderedStream().collect(Collectors.toList()))
|
factoryCustomizers.orderedStream().collect(Collectors.toList()))
|
||||||
.createConnectionFactory(ActiveMQConnectionFactory.class);
|
.createConnectionFactory(ActiveMQConnectionFactory.class);
|
||||||
|
@ -68,16 +73,12 @@ class ActiveMQConnectionFactoryConfiguration {
|
||||||
static class CachingConnectionFactoryConfiguration {
|
static class CachingConnectionFactoryConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(prefix = "spring.jms.cache", name = "enabled", havingValue = "true",
|
|
||||||
matchIfMissing = true)
|
|
||||||
CachingConnectionFactory cachingJmsConnectionFactory(JmsProperties jmsProperties,
|
CachingConnectionFactory cachingJmsConnectionFactory(JmsProperties jmsProperties,
|
||||||
ActiveMQProperties properties,
|
ActiveMQProperties properties,
|
||||||
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
|
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
|
||||||
JmsProperties.Cache cacheProperties = jmsProperties.getCache();
|
JmsProperties.Cache cacheProperties = jmsProperties.getCache();
|
||||||
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(
|
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(
|
||||||
new ActiveMQConnectionFactoryFactory(properties,
|
createJmsConnectionFactory(properties, factoryCustomizers));
|
||||||
factoryCustomizers.orderedStream().collect(Collectors.toList()))
|
|
||||||
.createConnectionFactory(ActiveMQConnectionFactory.class));
|
|
||||||
connectionFactory.setCacheConsumers(cacheProperties.isConsumers());
|
connectionFactory.setCacheConsumers(cacheProperties.isConsumers());
|
||||||
connectionFactory.setCacheProducers(cacheProperties.isProducers());
|
connectionFactory.setCacheProducers(cacheProperties.isProducers());
|
||||||
connectionFactory.setSessionCacheSize(cacheProperties.getSessionCacheSize());
|
connectionFactory.setSessionCacheSize(cacheProperties.getSessionCacheSize());
|
||||||
|
|
|
@ -194,6 +194,7 @@ class EmbeddedMongoAutoConfigurationTests {
|
||||||
void customMongoServerConfiguration() {
|
void customMongoServerConfiguration() {
|
||||||
load(CustomMongoConfiguration.class);
|
load(CustomMongoConfiguration.class);
|
||||||
Map<String, MongoClient> mongoClients = this.context.getBeansOfType(MongoClient.class);
|
Map<String, MongoClient> mongoClients = this.context.getBeansOfType(MongoClient.class);
|
||||||
|
assertThat(mongoClients).isNotEmpty();
|
||||||
for (String mongoClientBeanName : mongoClients.keySet()) {
|
for (String mongoClientBeanName : mongoClients.keySet()) {
|
||||||
BeanDefinition beanDefinition = this.context.getBeanFactory().getBeanDefinition(mongoClientBeanName);
|
BeanDefinition beanDefinition = this.context.getBeanFactory().getBeanDefinition(mongoClientBeanName);
|
||||||
assertThat(beanDefinition.getDependsOn()).contains("customMongoServer");
|
assertThat(beanDefinition.getDependsOn()).contains("customMongoServer");
|
||||||
|
|
Loading…
Reference in New Issue