本文整理汇总了Java中org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java DataSourceTransactionManagerAutoConfiguration类的具体用法?Java DataSourceTransactionManagerAutoConfiguration怎么用?Java DataSourceTransactionManagerAutoConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataSourceTransactionManagerAutoConfiguration类属于org.springframework.boot.autoconfigure.jdbc包,在下文中一共展示了DataSourceTransactionManagerAutoConfiguration类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: singleTransactionManager
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; //导入依赖的package包/类
@Test
public void singleTransactionManager() {
load(DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class);
PlatformTransactionManager transactionManager = this.context
.getBean(PlatformTransactionManager.class);
TransactionTemplate transactionTemplate = this.context
.getBean(TransactionTemplate.class);
assertThat(transactionTemplate.getTransactionManager())
.isSameAs(transactionManager);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:TransactionAutoConfigurationTests.java
示例2: defaultConfig
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; //导入依赖的package包/类
@Test
public void defaultConfig() {
load(Arrays.asList(EmbeddedDataSourceConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class),
"spring.session.store-type=jdbc");
JdbcOperationsSessionRepository repository = validateSessionRepository(
JdbcOperationsSessionRepository.class);
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
.isEqualTo("SPRING_SESSION");
assertThat(this.context.getBean(JdbcOperations.class)
.queryForList("select * from SPRING_SESSION")).isEmpty();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:SessionAutoConfigurationJdbcTests.java
示例3: disableDatabaseInitializer
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; //导入依赖的package包/类
@Test
public void disableDatabaseInitializer() {
load(Arrays.asList(EmbeddedDataSourceConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class),
"spring.session.store-type=jdbc",
"spring.session.jdbc.initializer.enabled=false");
JdbcOperationsSessionRepository repository = validateSessionRepository(
JdbcOperationsSessionRepository.class);
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
.isEqualTo("SPRING_SESSION");
this.thrown.expect(BadSqlGrammarException.class);
assertThat(this.context.getBean(JdbcOperations.class)
.queryForList("select * from SPRING_SESSION")).isEmpty();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:SessionAutoConfigurationJdbcTests.java
示例4: customTableName
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; //导入依赖的package包/类
@Test
public void customTableName() {
load(Arrays.asList(EmbeddedDataSourceConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class),
"spring.session.store-type=jdbc",
"spring.session.jdbc.table-name=FOO_BAR",
"spring.session.jdbc.schema=classpath:session/custom-schema-h2.sql");
JdbcOperationsSessionRepository repository = validateSessionRepository(
JdbcOperationsSessionRepository.class);
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
.isEqualTo("FOO_BAR");
assertThat(this.context.getBean(JdbcOperations.class)
.queryForList("select * from FOO_BAR")).isEmpty();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:SessionAutoConfigurationJdbcTests.java
示例5: testDataSourceTransactionManagerNotCreated
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; //导入依赖的package包/类
@Test
public void testDataSourceTransactionManagerNotCreated() throws Exception {
this.context.register(DataSourceTransactionManagerAutoConfiguration.class);
setupTestConfiguration();
this.context.refresh();
assertThat(this.context.getBean(DataSource.class)).isNotNull();
assertThat(this.context.getBean("transactionManager"))
.isInstanceOf(JpaTransactionManager.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:AbstractJpaAutoConfigurationTests.java
示例6: jdbcSessionStore
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; //导入依赖的package包/类
@Test
public void jdbcSessionStore() {
load(Arrays.asList(EmbeddedDataSourceConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class),
"spring.session.store-type=jdbc");
JdbcOperationsSessionRepository repository = validateSessionRepository(
JdbcOperationsSessionRepository.class);
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
.isEqualTo("SPRING_SESSION");
}
示例7: jdbcSessionStoreCustomTableName
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; //导入依赖的package包/类
@Test
public void jdbcSessionStoreCustomTableName() {
load(Arrays.asList(EmbeddedDataSourceConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class),
"spring.session.store-type=jdbc",
"spring.session.jdbc.table-name=FOO_BAR");
JdbcOperationsSessionRepository repository = validateSessionRepository(
JdbcOperationsSessionRepository.class);
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
.isEqualTo("FOO_BAR");
}
示例8: singleTransactionManager
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; //导入依赖的package包/类
@Test
public void singleTransactionManager() {
load(DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class);
PlatformTransactionManager transactionManager = this.context
.getBean(PlatformTransactionManager.class);
TransactionTemplate transactionTemplate = this.context
.getBean(TransactionTemplate.class);
assertSame(transactionManager, transactionTemplate.getTransactionManager());
}
示例9: testDataSourceTransactionManagerNotCreated
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; //导入依赖的package包/类
@Test
public void testDataSourceTransactionManagerNotCreated() throws Exception {
this.context.register(DataSourceTransactionManagerAutoConfiguration.class);
setupTestConfiguration();
this.context.refresh();
assertNotNull(this.context.getBean(DataSource.class));
assertTrue(this.context
.getBean("transactionManager") instanceof JpaTransactionManager);
}