bswen / bswen-project

code for www.bswen.com
http://www.bswen.com
Apache License 2.0
20 stars 34 forks source link

2018/05/springboot-How-to-setup-datasources-dynamically-in-springboot #14

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

How to setup datasources dynamically in springboot

  1. Introduction This post would demo how to setup the datasources dynamically in the spring or springboot application.

https://www.bswen.com/2018/05/springboot-How-to-setup-datasources-dynamically-in-springboot.html

wucun commented 3 years ago

For 9.1 example, I'm really like to see an example how to read a bean property from ApplicationContext.xml and update it with a new value.

Btw, the sections after 9.1 were numbered incorrectly.

bswen commented 3 years ago

Thanks for your feedback, I would improve the blog content.

wucun commented 3 years ago

After playing the example in 9.1, finally I got what I want to do. Excellent! Thank you very much!

bswen commented 3 years ago

You are welcome, and I have written a post about spring boot and xml configuration example, here is the link: https://github.com/bswen/bswen-project/tree/master/spring-boot-applicationxml

wucun commented 3 years ago

Hello again, BSWen. How to make your 9.1 code to work for a bean? My datasource is defined in a bean. Especially I'm afraid that this line " @ConfigurationProperties(prefix="spring.datasource") " probably won't work anymore.

wucun commented 3 years ago

By the way mu project is an old spring project. It uses just beans, no Spring Boot so I don't see DataSourceConfig is ever triggered.