Merge branch '2.1.x'

pull/15554/head
Andy Wilkinson 6 years ago
commit ddf64802c0

@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration; import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration;
import org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration; import org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
@ -33,6 +32,7 @@ import org.springframework.context.annotation.Import;
* *
* @author Josh Long * @author Josh Long
* @author Phillip Webb * @author Phillip Webb
* @author Nishant Raut
* @since 1.2.0 * @since 1.2.0
*/ */
@Configuration @Configuration
@ -43,7 +43,6 @@ import org.springframework.context.annotation.Import;
HibernateJpaAutoConfiguration.class }) HibernateJpaAutoConfiguration.class })
@Import({ JndiJtaConfiguration.class, BitronixJtaConfiguration.class, @Import({ JndiJtaConfiguration.class, BitronixJtaConfiguration.class,
AtomikosJtaConfiguration.class }) AtomikosJtaConfiguration.class })
@EnableConfigurationProperties(JtaProperties.class)
public class JtaAutoConfiguration { public class JtaAutoConfiguration {
} }

@ -42,7 +42,6 @@ import org.junit.rules.TemporaryFolder;
import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration; import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.jdbc.XADataSourceWrapper; import org.springframework.boot.jdbc.XADataSourceWrapper;
import org.springframework.boot.jms.XAConnectionFactoryWrapper; import org.springframework.boot.jms.XAConnectionFactoryWrapper;
import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean; import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean;
@ -70,6 +69,7 @@ import static org.mockito.Mockito.mock;
* @author Phillip Webb * @author Phillip Webb
* @author Andy Wilkinson * @author Andy Wilkinson
* @author Kazuki Shimizu * @author Kazuki Shimizu
* @author Nishant Raut
*/ */
public class JtaAutoConfigurationTests { public class JtaAutoConfigurationTests {
@ -134,7 +134,7 @@ public class JtaAutoConfigurationTests {
@Test @Test
public void defaultBitronixServerId() throws UnknownHostException { public void defaultBitronixServerId() throws UnknownHostException {
this.context = new AnnotationConfigApplicationContext( this.context = new AnnotationConfigApplicationContext(
JtaPropertiesConfiguration.class, BitronixJtaConfiguration.class); BitronixJtaConfiguration.class);
String serverId = this.context.getBean(bitronix.tm.Configuration.class) String serverId = this.context.getBean(bitronix.tm.Configuration.class)
.getServerId(); .getServerId();
assertThat(serverId).isEqualTo(InetAddress.getLocalHost().getHostAddress()); assertThat(serverId).isEqualTo(InetAddress.getLocalHost().getHostAddress());
@ -145,8 +145,7 @@ public class JtaAutoConfigurationTests {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.jta.transactionManagerId:custom") TestPropertyValues.of("spring.jta.transactionManagerId:custom")
.applyTo(this.context); .applyTo(this.context);
this.context.register(JtaPropertiesConfiguration.class, this.context.register(BitronixJtaConfiguration.class);
BitronixJtaConfiguration.class);
this.context.refresh(); this.context.refresh();
String serverId = this.context.getBean(bitronix.tm.Configuration.class) String serverId = this.context.getBean(bitronix.tm.Configuration.class)
.getServerId(); .getServerId();
@ -159,8 +158,7 @@ public class JtaAutoConfigurationTests {
File logs = this.temp.newFolder("jta"); File logs = this.temp.newFolder("jta");
TestPropertyValues.of("spring.jta.logDir:" + logs.getAbsolutePath()) TestPropertyValues.of("spring.jta.logDir:" + logs.getAbsolutePath())
.applyTo(this.context); .applyTo(this.context);
this.context.register(JtaPropertiesConfiguration.class, this.context.register(AtomikosJtaConfiguration.class);
AtomikosJtaConfiguration.class);
this.context.refresh(); this.context.refresh();
File epochFile = new File(logs, "tmlog0.log"); File epochFile = new File(logs, "tmlog0.log");
@ -174,8 +172,7 @@ public class JtaAutoConfigurationTests {
.of("spring.jta.atomikos.connectionfactory.minPoolSize:5", .of("spring.jta.atomikos.connectionfactory.minPoolSize:5",
"spring.jta.atomikos.connectionfactory.maxPoolSize:10") "spring.jta.atomikos.connectionfactory.maxPoolSize:10")
.applyTo(this.context); .applyTo(this.context);
this.context.register(JtaPropertiesConfiguration.class, this.context.register(AtomikosJtaConfiguration.class, PoolConfiguration.class);
AtomikosJtaConfiguration.class, PoolConfiguration.class);
this.context.refresh(); this.context.refresh();
AtomikosConnectionFactoryBean connectionFactory = this.context AtomikosConnectionFactoryBean connectionFactory = this.context
.getBean(AtomikosConnectionFactoryBean.class); .getBean(AtomikosConnectionFactoryBean.class);
@ -190,8 +187,7 @@ public class JtaAutoConfigurationTests {
.of("spring.jta.bitronix.connectionfactory.minPoolSize:5", .of("spring.jta.bitronix.connectionfactory.minPoolSize:5",
"spring.jta.bitronix.connectionfactory.maxPoolSize:10") "spring.jta.bitronix.connectionfactory.maxPoolSize:10")
.applyTo(this.context); .applyTo(this.context);
this.context.register(JtaPropertiesConfiguration.class, this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class);
BitronixJtaConfiguration.class, PoolConfiguration.class);
this.context.refresh(); this.context.refresh();
PoolingConnectionFactoryBean connectionFactory = this.context PoolingConnectionFactoryBean connectionFactory = this.context
.getBean(PoolingConnectionFactoryBean.class); .getBean(PoolingConnectionFactoryBean.class);
@ -206,8 +202,7 @@ public class JtaAutoConfigurationTests {
.of("spring.jta.atomikos.datasource.minPoolSize:5", .of("spring.jta.atomikos.datasource.minPoolSize:5",
"spring.jta.atomikos.datasource.maxPoolSize:10") "spring.jta.atomikos.datasource.maxPoolSize:10")
.applyTo(this.context); .applyTo(this.context);
this.context.register(JtaPropertiesConfiguration.class, this.context.register(AtomikosJtaConfiguration.class, PoolConfiguration.class);
AtomikosJtaConfiguration.class, PoolConfiguration.class);
this.context.refresh(); this.context.refresh();
AtomikosDataSourceBean dataSource = this.context AtomikosDataSourceBean dataSource = this.context
.getBean(AtomikosDataSourceBean.class); .getBean(AtomikosDataSourceBean.class);
@ -222,8 +217,7 @@ public class JtaAutoConfigurationTests {
.of("spring.jta.bitronix.datasource.minPoolSize:5", .of("spring.jta.bitronix.datasource.minPoolSize:5",
"spring.jta.bitronix.datasource.maxPoolSize:10") "spring.jta.bitronix.datasource.maxPoolSize:10")
.applyTo(this.context); .applyTo(this.context);
this.context.register(JtaPropertiesConfiguration.class, this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class);
BitronixJtaConfiguration.class, PoolConfiguration.class);
this.context.refresh(); this.context.refresh();
PoolingDataSourceBean dataSource = this.context PoolingDataSourceBean dataSource = this.context
.getBean(PoolingDataSourceBean.class); .getBean(PoolingDataSourceBean.class);
@ -263,12 +257,6 @@ public class JtaAutoConfigurationTests {
assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue(); assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue();
} }
@Configuration
@EnableConfigurationProperties(JtaProperties.class)
public static class JtaPropertiesConfiguration {
}
@Configuration @Configuration
public static class CustomTransactionManagerConfig { public static class CustomTransactionManagerConfig {

Loading…
Cancel
Save