Update tenant data source configuration.
All checks were successful
Build and Push Docker Images / build-and-push-backend (push) Successful in 28s
Build and Push Docker Images / build-and-push-frontend (push) Successful in 11s
Build and Push Docker Images / deploy-to-k8s (push) Successful in 1m19s

This commit is contained in:
Zuev
2026-03-13 02:48:03 +03:00
parent 9d2de1faaf
commit 10c06e726a

View File

@@ -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() {