All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.smilego.tenant.TenantConfiguration Maven / Gradle / Ivy

package io.smilego.tenant;

import io.smilego.tenant.configuration.ParamConfiguration;
import io.smilego.tenant.persistence.hibernate.CurrentTenantIdentifierResolverImpl;
import io.smilego.tenant.persistence.hibernate.DynamicDataSourceBasedMultiTenantConnectionProvider;
import io.smilego.tenant.service.ParamService;
import io.smilego.tenant.service.ServiceService;
import io.smilego.tenant.service.TenantService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty(name = "multitenancy.enabled", havingValue = "true", matchIfMissing = true)
public class TenantConfiguration {

    @Bean
    public TenantInterceptor tenantInterceptor(){
        return new TenantInterceptor();
    }

    @Bean
    public WebConfiguration webConfiguration(TenantInterceptor tenantInterceptor){
        return new WebConfiguration(tenantInterceptor);
    }

    @Bean
    public TenantService tenantService(){
        return new TenantService();
    }

    @Bean
    public ParamService paramService(){
        return new ParamService();
    }

    @Bean
    public ServiceService serviceService(){
        return new ServiceService();
    }

    @Bean
    public ParamConfiguration paramConfiguration(){
        return new ParamConfiguration();
    }

    @Bean
    public DynamicDataSourceBasedMultiTenantConnectionProvider dynamicDataSourceBasedMultiTenantConnectionProvider(){
        return new DynamicDataSourceBasedMultiTenantConnectionProvider();
    }

    @Bean
    public CurrentTenantIdentifierResolverImpl currentTenantIdentifierResolver(){
        return new CurrentTenantIdentifierResolverImpl();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy