io.smilego.tenant.flyway.InitialCacheTenantInitializer Maven / Gradle / Ivy
package io.smilego.tenant.flyway;
import io.smilego.tenant.persistence.hibernate.DynamicDataSourceBasedMultiTenantConnectionProvider;
import io.smilego.tenant.util.LogBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
public class InitialCacheTenantInitializer implements InitializingBean {
Logger log = LoggerFactory.getLogger(this.getClass());
@Autowired
@Qualifier(value = "dynamicDataSourceBasedMultiTenantConnectionProvider")
private DynamicDataSourceBasedMultiTenantConnectionProvider dynamicDataSourceBasedMultiTenantConnectionProvider;
@Override
public void afterPropertiesSet() throws Exception {
log.info(LogBuilder.of()
.header("Starting tenants")
.row("Database: masterDataSource").build());
dynamicDataSourceBasedMultiTenantConnectionProvider.cacheTenants();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy