Update tenant data source configuration.
This commit is contained in:
@@ -119,6 +119,10 @@ public class TenantDataSourceConfig implements WebMvcConfigurer {
|
||||
return new JpaTransactionManager(emf);
|
||||
}
|
||||
|
||||
@org.springframework.context.annotation.Lazy
|
||||
@org.springframework.beans.factory.annotation.Autowired
|
||||
private TenantRoutingDataSource tenantRoutingDataSource;
|
||||
|
||||
@Bean
|
||||
public TenantInterceptor tenantInterceptor(TenantRoutingDataSource routingDataSource) {
|
||||
TenantInterceptor interceptor = new TenantInterceptor();
|
||||
@@ -128,7 +132,8 @@ public class TenantDataSourceConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(tenantInterceptor()).addPathPatterns("/**");
|
||||
// Вызываем метод-бин с переданным параметром (будет перехвачен CGLIB)
|
||||
registry.addInterceptor(tenantInterceptor(tenantRoutingDataSource)).addPathPatterns("/**");
|
||||
}
|
||||
|
||||
private List<TenantConfig> loadTenantsFromFile() {
|
||||
|
||||
Reference in New Issue
Block a user