@Test public void atomikosDataSourcePoolConfiguration() { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, "spring.jta.atomikos.datasource.minPoolSize:5", "spring.jta.atomikos.datasource.maxPoolSize:10"); this.context.register(JtaPropertiesConfiguration.class, AtomikosJtaConfiguration.class, PoolConfiguration.class); this.context.refresh(); AtomikosDataSourceBean dataSource = this.context .getBean(AtomikosDataSourceBean.class); assertThat(dataSource.getMinPoolSize()).isEqualTo(5); assertThat(dataSource.getMaxPoolSize()).isEqualTo(10); }
@Test public void atomikosDataSourcePoolConfiguration() { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, "spring.jta.atomikos.datasource.minPoolSize:5", "spring.jta.atomikos.datasource.maxPoolSize:10"); this.context.register(JtaPropertiesConfiguration.class, AtomikosJtaConfiguration.class, PoolConfiguration.class); this.context.refresh(); AtomikosDataSourceBean dataSource = this.context .getBean(AtomikosDataSourceBean.class); assertThat(dataSource.getMinPoolSize(), is(equalTo(5))); assertThat(dataSource.getMaxPoolSize(), is(equalTo(10))); }
@Bean(initMethod = "init", destroyMethod = "destroy", value = "defaultDataSource") @Primary public AtomikosDataSourceBean defaultDataSource() { return new AtomikosDataSourceBean(); }