Created
February 4, 2017 11:47
-
-
Save alhafoudh/5b7e93f3d852da7ee92c11606a89d619 to your computer and use it in GitHub Desktop.
Spring multiple data sources
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sk.freevision.probase.config; | |
import org.springframework.context.annotation.Configuration; | |
@Configuration | |
//@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) | |
public class Config { | |
// @Bean(name = "metaDataSource") | |
// @Primary | |
// @ConfigurationProperties(prefix="datasource.metaDataSource") | |
// public DataSource metaDataSource() { | |
// return DataSourceBuilder.create().build(); | |
// } | |
// | |
// @Bean(name = "metaJdbcTemplate") | |
// public JdbcTemplate metaJdbcTemplate(@Qualifier(value = "metaDataSource") DataSource dataSource) { | |
// return new JdbcTemplate(dataSource); | |
// } | |
// | |
// @Bean(name = "dataDataSource") | |
// @ConfigurationProperties(prefix="datasource.dataDataSource") | |
// public DataSource dataDataSource() { | |
// return DataSourceBuilder.create().build(); | |
// } | |
// | |
// @Bean(name = "dataJdbcTemplate") | |
// public JdbcTemplate dataJdbcTemplate(@Qualifier(value = "dataDataSource") DataSource dataSource) { | |
// return new JdbcTemplate(dataSource); | |
// } | |
// | |
// @Bean(name = "dataSessionFactory") | |
// public LocalSessionFactoryBean dataSessionFactory() { | |
// LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean(); | |
// sessionFactoryBean.setDataSource(dataDataSource()); | |
// sessionFactoryBean.setConfigLocation(new ClassPathResource("hibernateData.cfg.xml")); | |
// | |
// return sessionFactoryBean; | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment