Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MultiTenantSpringLiquibase Example.

I have an application with Multi Tenant. However, this same application has liquibase. I need to run liquibase in all my datasources however, I can not use this Bean.

My application.yml

application

My bean:

    @Bean
public MultiTenantSpringLiquibase liquibase(){
    MultiTenantSpringLiquibase mt = new MultiTenantSpringLiquibase();
    return mt;
}

I do not know how to instantiate this bean, since the documentation does not make clear how to do.

http://www.liquibase.org/javadoc/liquibase/integration/spring/MultiTenantSpringLiquibase.html#setResourceLoader(org.springframework.core.io.ResourceLoader)

I also do not know how to set my application.yml and pass the tenants tree.

Could you help me?

like image 668
user3229393 Avatar asked May 03 '26 11:05

user3229393


1 Answers

I had similar issue, so I removed the liquibase aspect from my main project and created a separate spring boot application which mainly handles liquibase aspect and creates schemas. This Guy did a job well, take a look https://github.com/rmsantana/poc-multi-tenant/blob/master/src/main/java/com/rafael/Application.java

like image 66
MathGuy Avatar answered May 05 '26 23:05

MathGuy