|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2012-2016 the original author or authors. |
|
|
|
|
* Copyright 2012-2017 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -44,6 +44,7 @@ import org.junit.rules.ExpectedException;
@@ -44,6 +44,7 @@ import org.junit.rules.ExpectedException;
|
|
|
|
|
import org.springframework.beans.BeansException; |
|
|
|
|
import org.springframework.beans.factory.NoSuchBeanDefinitionException; |
|
|
|
|
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration; |
|
|
|
|
import org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfigurationTests.CustomNarayanaRecoveryManagerConfiguration.CustomNarayanaRecoveryManagerBean; |
|
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
|
|
|
|
import org.springframework.boot.jta.XAConnectionFactoryWrapper; |
|
|
|
|
import org.springframework.boot.jta.XADataSourceWrapper; |
|
|
|
|
@ -55,6 +56,7 @@ import org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean;
@@ -55,6 +56,7 @@ import org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean;
|
|
|
|
|
import org.springframework.boot.jta.bitronix.PoolingDataSourceBean; |
|
|
|
|
import org.springframework.boot.jta.narayana.NarayanaBeanFactoryPostProcessor; |
|
|
|
|
import org.springframework.boot.jta.narayana.NarayanaConfigurationBean; |
|
|
|
|
import org.springframework.boot.jta.narayana.NarayanaRecoveryManagerBean; |
|
|
|
|
import org.springframework.boot.test.util.EnvironmentTestUtils; |
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
|
@ -294,6 +296,16 @@ public class JtaAutoConfigurationTests {
@@ -294,6 +296,16 @@ public class JtaAutoConfigurationTests {
|
|
|
|
|
assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void narayanaRecoveryManagerBeanCanBeCustomized() { |
|
|
|
|
this.context = new AnnotationConfigApplicationContext(); |
|
|
|
|
this.context.register(CustomNarayanaRecoveryManagerConfiguration.class, |
|
|
|
|
JtaProperties.class, NarayanaJtaConfiguration.class); |
|
|
|
|
this.context.refresh(); |
|
|
|
|
assertThat(this.context.getBean(NarayanaRecoveryManagerBean.class)) |
|
|
|
|
.isInstanceOf(CustomNarayanaRecoveryManagerBean.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
|
@EnableConfigurationProperties(JtaProperties.class) |
|
|
|
|
public static class JtaPropertiesConfiguration { |
|
|
|
|
@ -336,4 +348,25 @@ public class JtaAutoConfigurationTests {
@@ -336,4 +348,25 @@ public class JtaAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
|
public static class CustomNarayanaRecoveryManagerConfiguration { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public NarayanaRecoveryManagerBean customRecoveryManagerBean( |
|
|
|
|
RecoveryManagerService recoveryManagerService) { |
|
|
|
|
return new CustomNarayanaRecoveryManagerBean(recoveryManagerService); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static final class CustomNarayanaRecoveryManagerBean |
|
|
|
|
extends NarayanaRecoveryManagerBean { |
|
|
|
|
|
|
|
|
|
private CustomNarayanaRecoveryManagerBean( |
|
|
|
|
RecoveryManagerService recoveryManagerService) { |
|
|
|
|
super(recoveryManagerService); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|