tag:blogger.com,1999:blog-4306704057846428012.post5083382772605752654..comments2023-08-20T14:06:40.414+03:00Comments on Software RnD: Spring-boot JDBC with multiple DataSources sampleXantoroharahttp://www.blogger.com/profile/05302201977749671284noreply@blogger.comBlogger17125tag:blogger.com,1999:blog-4306704057846428012.post-83348331661343734122019-05-08T06:15:37.245+03:002019-05-08T06:15:37.245+03:00How can we management transactions for multiple Da...How can we management transactions for multiple Data sources at the same time with @Transactional annotation?Iftihttps://www.blogger.com/profile/07086598777532722821noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-40273700889170254212016-11-18T21:29:38.220+03:002016-11-18T21:29:38.220+03:00Here is the code...
@Configuration
public class D...Here is the code...<br /><br />@Configuration<br />public class DatabaseConfig {<br /><br /> @Bean(name = "ds-mx")<br /> @Primary<br /> @ConfigurationProperties(prefix="spring.datasource")<br /> public DataSource dataSourceMX() {<br /> return DataSourceBuilder.create().build();<br /> }<br /><br /> @Bean(name = "ds-cl")<br /> @ConfigurationProperties(prefix="spring.datasource.cl")<br /> public DataSource dataSourceCL() {<br /> return DataSourceBuilder.create().build();<br /> }<br /><br />Service<br />--------<br />@Service<br />public class McacMapperService implements IMcacMapperService {<br /><br /> private static final Logger LOG = LoggerFactory.getLogger(McacMapperService.class);<br /> <br /> @Autowired <br /> private JdbcTemplate jdbcTemplate;<br /><br /> @Autowired(required=true)<br /> private DatabaseConfig databaseConfig;<br /> <br />Elchurihttps://www.blogger.com/profile/15719269239048797750noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-16699628915505218922016-11-18T21:23:51.223+03:002016-11-18T21:23:51.223+03:00HI all,
I am trying implement Multi-Datasource. I...HI all,<br /><br />I am trying implement Multi-Datasource. I'am getting below error. Please advice. Thanks<br /><br />Error :NoSuchBeanDefinitionException: No qualifying bean of type [com.bns.mcac.config.DatabaseConfig] found for dependencyElchurihttps://www.blogger.com/profile/15719269239048797750noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-46867842119543804152016-06-02T22:19:21.046+03:002016-06-02T22:19:21.046+03:00Hello,
It's still not working for me. I am no...Hello,<br /><br />It's still not working for me. I am not using controller , but making call to repository directly from mail class.<br />I even tried using - @Primary as some of the posts suggested -<br /><br />---------------<br />@Configuration<br />@ConfigurationProperties(prefix = "spring.ds_items") <br />public class DatabaseItemsConfig { <br /> <br /> @Primary<br /> @Bean(name = "dsItems") <br /> public DataSource dataSource() { <br /> return DataSourceBuilder.create().build(); <br /> } <br /> <br /> @Bean(name = "jdbcItems") <br /> public JdbcTemplate jdbcTemplate(DataSource dsItems) { <br /> return new JdbcTemplate(dsItems); <br /> } <br />------------------<br /><br />But I am getting this erro - java.sql.SQLException: The url cannot be nullAnonymoushttps://www.blogger.com/profile/12558787976609965251noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-23411764764261683312015-11-12T11:36:52.459+03:002015-11-12T11:36:52.459+03:00Very helpful :). One minor typo:
item.price = rs....Very helpful :). One minor typo:<br /><br />item.price = rs.getDouble("id");<br /><br />note the field names.Stephan Bealhttps://www.blogger.com/profile/09644587225944529456noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-26199825117463558712015-07-21T18:15:23.829+03:002015-07-21T18:15:23.829+03:00Awesome - thank you for this, it helped a lot.
/A...Awesome - thank you for this, it helped a lot.<br /><br />/AAnonymoushttps://www.blogger.com/profile/18154272829129744467noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-8798316340119707582015-07-21T18:14:23.132+03:002015-07-21T18:14:23.132+03:00Awesome - thank you very much for this example.
/...Awesome - thank you very much for this example.<br /><br />/AAnonymoushttps://www.blogger.com/profile/18154272829129744467noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-47377176363635912512015-06-09T22:44:47.190+03:002015-06-09T22:44:47.190+03:00Thank your blog,
but, there are one big issue:
Aft...Thank your blog,<br />but, there are one big issue:<br />After Spring Boot 1.1.0.RELEASE, no more TomcatDataSourceConfiguration <br />How could I do for handling two different database?Anonymoushttps://www.blogger.com/profile/03908113596920979683noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-44505389400164915702015-06-09T01:22:19.571+03:002015-06-09T01:22:19.571+03:00After Spring Boot 1.1.0.Release no more
org.spri...After Spring Boot 1.1.0.Release no more <br />org.springframework.boot.autoconfigure.jdbc.TomcatDataSourceConfiguration<br /><br />Please advice any other way to implement multiple database?Anonymoushttps://www.blogger.com/profile/03908113596920979683noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-30653051835312605632015-06-09T01:22:08.324+03:002015-06-09T01:22:08.324+03:00After Spring Boot 1.1.0.Release no more
org.spri...After Spring Boot 1.1.0.Release no more <br />org.springframework.boot.autoconfigure.jdbc.TomcatDataSourceConfiguration<br /><br />Please advice any other way to implement multiple database?Anonymoushttps://www.blogger.com/profile/03908113596920979683noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-65348901573065694702015-06-09T01:20:52.129+03:002015-06-09T01:20:52.129+03:00After Spring Boot 1.1.0.Release, there are no more...After Spring Boot 1.1.0.Release, there are no more <br />org.springframework.boot.autoconfigure.jdbc.TomcatDataSourceConfiguration<br /><br />this is basic change. any suggestions?Anonymoushttps://www.blogger.com/profile/03908113596920979683noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-10506620279570882262015-02-06T14:02:47.883+03:002015-02-06T14:02:47.883+03:00Thanks very much!Thanks very much!TSM Ltdhttps://www.blogger.com/profile/09961802058827511964noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-79036068290577885312015-02-06T14:02:18.846+03:002015-02-06T14:02:18.846+03:00Thanks very much, got me back on the road again......Thanks very much, got me back on the road again...TSM Ltdhttps://www.blogger.com/profile/09961802058827511964noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-53553934234246008182014-09-09T13:19:29.891+04:002014-09-09T13:19:29.891+04:00ThanksThankssahil mohindroohttps://www.blogger.com/profile/00085229011326538998noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-38028073672218101222014-09-09T13:19:20.785+04:002014-09-09T13:19:20.785+04:00ThanksThankssahil mohindroohttps://www.blogger.com/profile/00085229011326538998noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-83048953431668518192013-12-16T22:51:46.407+04:002013-12-16T22:51:46.407+04:00Thanks! This was very helpful for me.Thanks! This was very helpful for me.Anonymoushttps://www.blogger.com/profile/13099890772896298633noreply@blogger.comtag:blogger.com,1999:blog-4306704057846428012.post-70000769853938015202013-12-16T22:51:30.029+04:002013-12-16T22:51:30.029+04:00Thanks this was very helpful for me!Thanks this was very helpful for me!Anonymoushttps://www.blogger.com/profile/13099890772896298633noreply@blogger.com