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