RED-6270: Extracted common qualifiers into a constant

This commit is contained in:
Viktor Seifert 2023-05-02 12:45:38 +02:00
parent 412b3fb3c8
commit 4ad76962ec

View File

@ -9,7 +9,8 @@ import org.springframework.cloud.openfeign.support.SortJacksonModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.retry.backoff.ExponentialBackOffPolicy;
import org.springframework.retry.policy.SimpleRetryPolicy;
@ -26,6 +27,9 @@ import com.iqser.red.service.persistence.management.v1.processor.settings.FileMa
@EnableFeignClients(basePackageClasses = {PDFTronClient.class, StatusReportClient.class, SearchClient.class, RedactionClient.class})
public class PersistenceServiceProcessorConfiguration {
public static final String TENANT_DATA_SOURCE_QUALIFIER = "multiTenantDataSource";
@Bean
public PageJacksonModule pageJacksonModule() {
@ -58,7 +62,9 @@ public class PersistenceServiceProcessorConfiguration {
@Bean
public JdbcTemplate jdbcTemplate(@Qualifier("multiTenantDataSource") @Lazy DataSource dataSource) {
@DependsOn(TENANT_DATA_SOURCE_QUALIFIER)
@Primary
public JdbcTemplate tenantJdbcTemplate(@Qualifier(TENANT_DATA_SOURCE_QUALIFIER) DataSource dataSource) {
return new JdbcTemplate(dataSource);
}