I need to set up liquibase
for two datasources
in Spring
, at the moment it seems that only one liquibase
set up is possible and you can choose for which data source.
相关问题
- java.lang.IllegalArgumentException: Cannot set to
- Spring Data MongoDB - lazy access to some fields
- Declaring an explict object dependency in Spring
- Decoding body parameters with Spring
- Spring Integration - Inbound file endpoint. How to
相关文章
- java JDK动态代理和cglib动态代理最后获取的代理对象都为null的问题
- org.xml.sax.SAXParseException; lineNumber: 7; colu
- SpringMVC如何把File封装到Map中?
- Spring: controller inheritance using @Controller a
- How to load @Configuration classes from separate J
- Java spring framework - how to set content type?
- Java/Spring MVC: provide request context to child
- Spring 5 Web Reactive - Hot Publishing - How to us
If you are using spring boot, here is the setup which can help you:
Configuration class:
properties.yml
Just have 2 datasources and 2 beans
You can also run multiple liquibase instance (i.e. not only limit to a primary and a secondary).
e.g. Your configuration java can have:
Your application.property can have:
And (excitingly), these springLiquibase instances can use the same Datasource, or different DataSource... however you like it.
Running order? I haven't found any official document, from my observation in debug, all liquibase migration runs according to the order you write in application.properties. Those who wants to run migration in one datasource, then go to another datasource, then come back to this datasource and run something else,,, you may want to try this multiple liquibase instance approach.
I've done a project that I can create multiple dataSources with your specific changeSets, so if you need to add another dataSource, it would just change your application.yml, no longer needing to change the code.
Configuration class
application.yml
Link of repository: https://github.com/dijalmasilva/spring-boot-multitenancy-datasource-liquibase