Fix JmsTemplate default pubSubDomain setting
Prior to this commit, a JmsTemplate bean created automatically by Boot had its "pubSubDomain" flag enabled. It's far more usual to fallback on queue rather than topic. This commit flips the default value of the configuration property.
This commit is contained in:
		
							parent
							
								
									ae7098ae1d
								
							
						
					
					
						commit
						c4ffe721c7
					
				|  | @ -21,7 +21,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; | ||||||
| @ConfigurationProperties(prefix = "spring.jms") | @ConfigurationProperties(prefix = "spring.jms") | ||||||
| public class JmsTemplateProperties { | public class JmsTemplateProperties { | ||||||
| 
 | 
 | ||||||
| 	private boolean pubSubDomain = true; | 	private boolean pubSubDomain = false; | ||||||
| 
 | 
 | ||||||
| 	public boolean isPubSubDomain() { | 	public boolean isPubSubDomain() { | ||||||
| 		return this.pubSubDomain; | 		return this.pubSubDomain; | ||||||
|  |  | ||||||
|  | @ -94,23 +94,23 @@ public class JmsTemplateAutoConfigurationTests { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	public void testPubSubEnabledByDefault() { | 	public void testPubSubDisabledByDefault() { | ||||||
| 		this.context = new AnnotationConfigApplicationContext(); | 		this.context = new AnnotationConfigApplicationContext(); | ||||||
| 		this.context | 		this.context | ||||||
| 				.register(TestConfiguration.class, JmsTemplateAutoConfiguration.class); | 				.register(TestConfiguration.class, JmsTemplateAutoConfiguration.class); | ||||||
| 		this.context.refresh(); | 		this.context.refresh(); | ||||||
| 		JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class); | 		JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class); | ||||||
| 		assertTrue(jmsTemplate.isPubSubDomain()); | 		assertFalse(jmsTemplate.isPubSubDomain()); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	public void testJmsTemplatePostProcessedSoThatPubSubIsFalse() { | 	public void testJmsTemplatePostProcessedSoThatPubSubIsTrue() { | ||||||
| 		this.context = new AnnotationConfigApplicationContext(); | 		this.context = new AnnotationConfigApplicationContext(); | ||||||
| 		this.context.register(TestConfiguration4.class, | 		this.context.register(TestConfiguration4.class, | ||||||
| 				JmsTemplateAutoConfiguration.class); | 				JmsTemplateAutoConfiguration.class); | ||||||
| 		this.context.refresh(); | 		this.context.refresh(); | ||||||
| 		JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class); | 		JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class); | ||||||
| 		assertFalse(jmsTemplate.isPubSubDomain()); | 		assertTrue(jmsTemplate.isPubSubDomain()); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
|  | @ -262,7 +262,7 @@ public class JmsTemplateAutoConfigurationTests { | ||||||
| 				throws BeansException { | 				throws BeansException { | ||||||
| 			if (bean.getClass().isAssignableFrom(JmsTemplate.class)) { | 			if (bean.getClass().isAssignableFrom(JmsTemplate.class)) { | ||||||
| 				JmsTemplate jmsTemplate = (JmsTemplate) bean; | 				JmsTemplate jmsTemplate = (JmsTemplate) bean; | ||||||
| 				jmsTemplate.setPubSubDomain(false); | 				jmsTemplate.setPubSubDomain(true); | ||||||
| 			} | 			} | ||||||
| 			return bean; | 			return bean; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -171,7 +171,7 @@ content into your application; rather pick only the properties that you need. | ||||||
| 	spring.activemq.pooled=false | 	spring.activemq.pooled=false | ||||||
| 
 | 
 | ||||||
| 	# JMS ({sc-spring-boot-autoconfigure}/jms/JmsTemplateProperties.{sc-ext}[JmsTemplateProperties]) | 	# JMS ({sc-spring-boot-autoconfigure}/jms/JmsTemplateProperties.{sc-ext}[JmsTemplateProperties]) | ||||||
| 	spring.jms.pub-sub-domain= | 	spring.jms.pub-sub-domain= # false for queue (default), true for topic | ||||||
| 
 | 
 | ||||||
| 	# SPRING BATCH ({sc-spring-boot-autoconfigure}/batch/BatchDatabaseInitializer.{sc-ext}[BatchDatabaseInitializer]) | 	# SPRING BATCH ({sc-spring-boot-autoconfigure}/batch/BatchDatabaseInitializer.{sc-ext}[BatchDatabaseInitializer]) | ||||||
| 	spring.batch.job.names=job1,job2 | 	spring.batch.job.names=job1,job2 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue