FINERACT-2181: Refactor UpdateTrialBalanceDetailsConfig injection instead of Autowired

This commit is contained in:
a7med3del1973
2025-03-19 12:12:37 +01:00
committed by Adam Saghy
parent 9d53d1cb90
commit 9fe993342b
6 changed files with 26 additions and 34 deletions
@@ -18,6 +18,7 @@
*/ */
package org.apache.fineract.accounting.glaccount.jobs.updatetrialbalancedetails; package org.apache.fineract.accounting.glaccount.jobs.updatetrialbalancedetails;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.accounting.glaccount.domain.TrialBalanceRepositoryWrapper; import org.apache.fineract.accounting.glaccount.domain.TrialBalanceRepositoryWrapper;
import org.apache.fineract.infrastructure.core.service.database.RoutingDataSourceServiceFactory; import org.apache.fineract.infrastructure.core.service.database.RoutingDataSourceServiceFactory;
import org.apache.fineract.infrastructure.jobs.service.JobName; import org.apache.fineract.infrastructure.jobs.service.JobName;
@@ -27,22 +28,18 @@ import org.springframework.batch.core.job.builder.JobBuilder;
import org.springframework.batch.core.launch.support.RunIdIncrementer; import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.core.step.builder.StepBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
@Configuration @Configuration
@RequiredArgsConstructor
public class UpdateTrialBalanceDetailsConfig { public class UpdateTrialBalanceDetailsConfig {
@Autowired private final JobRepository jobRepository;
private JobRepository jobRepository; private final PlatformTransactionManager transactionManager;
@Autowired private final RoutingDataSourceServiceFactory dataSourceServiceFactory;
private PlatformTransactionManager transactionManager; private final TrialBalanceRepositoryWrapper trialBalanceRepositoryWrapper;
@Autowired
private RoutingDataSourceServiceFactory dataSourceServiceFactory;
@Autowired
private TrialBalanceRepositoryWrapper trialBalanceRepositoryWrapper;
@Bean @Bean
protected Step updateTrialBalanceDetailsStep() { protected Step updateTrialBalanceDetailsStep() {
@@ -18,6 +18,7 @@
*/ */
package org.apache.fineract.test.api; package org.apache.fineract.test.api;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.client.services.BatchApiApi; import org.apache.fineract.client.services.BatchApiApi;
import org.apache.fineract.client.services.BusinessDateManagementApi; import org.apache.fineract.client.services.BusinessDateManagementApi;
import org.apache.fineract.client.services.BusinessStepConfigurationApi; import org.apache.fineract.client.services.BusinessStepConfigurationApi;
@@ -56,15 +57,14 @@ import org.apache.fineract.client.services.SchedulerJobApi;
import org.apache.fineract.client.services.UsersApi; import org.apache.fineract.client.services.UsersApi;
import org.apache.fineract.client.util.FineractClient; import org.apache.fineract.client.util.FineractClient;
import org.apache.fineract.test.stepdef.loan.LoanProductsCustomApi; import org.apache.fineract.test.stepdef.loan.LoanProductsCustomApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
@RequiredArgsConstructor
public class ApiConfiguration { public class ApiConfiguration {
@Autowired private final FineractClient fineractClient;
private FineractClient fineractClient;
@Bean @Bean
public SchedulerApi schedulerApi() { public SchedulerApi schedulerApi() {
@@ -19,18 +19,18 @@
package org.apache.fineract.test.api; package org.apache.fineract.test.api;
import java.time.Duration; import java.time.Duration;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.client.util.FineractClient; import org.apache.fineract.client.util.FineractClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
@Slf4j @Slf4j
@RequiredArgsConstructor
public class FineractClientConfiguration { public class FineractClientConfiguration {
@Autowired private final ApiProperties apiProperties;
private ApiProperties apiProperties;
@Bean @Bean
public FineractClient fineractClient() { public FineractClient fineractClient() {
@@ -20,20 +20,19 @@ package org.apache.fineract.test.stepdef.hook;
import io.cucumber.java.After; import io.cucumber.java.After;
import io.cucumber.java.Scenario; import io.cucumber.java.Scenario;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.test.testrail.TestRailClient; import org.apache.fineract.test.testrail.TestRailClient;
import org.apache.fineract.test.testrail.TestRailProperties; import org.apache.fineract.test.testrail.TestRailProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
@Slf4j @Slf4j
@RequiredArgsConstructor
public class TestRailLifecycleHook { public class TestRailLifecycleHook {
@Autowired private final TestRailProperties testRailProperties;
private TestRailProperties testRailProperties;
@Autowired private final ApplicationContext applicationContext;
private ApplicationContext applicationContext;
@After @After
public void tearDown(Scenario scenario) { public void tearDown(Scenario scenario) {
@@ -18,6 +18,7 @@
*/ */
package org.apache.fineract.portfolio.loanaccount.jobs.addperiodicaccrualentries; package org.apache.fineract.portfolio.loanaccount.jobs.addperiodicaccrualentries;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.jobs.service.JobName; import org.apache.fineract.infrastructure.jobs.service.JobName;
import org.apache.fineract.portfolio.loanaccount.service.LoanAccrualsProcessingService; import org.apache.fineract.portfolio.loanaccount.service.LoanAccrualsProcessingService;
import org.springframework.batch.core.Job; import org.springframework.batch.core.Job;
@@ -26,20 +27,17 @@ import org.springframework.batch.core.job.builder.JobBuilder;
import org.springframework.batch.core.launch.support.RunIdIncrementer; import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.core.step.builder.StepBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
@Configuration @Configuration
@RequiredArgsConstructor
public class AddPeriodicAccrualEntriesConfig { public class AddPeriodicAccrualEntriesConfig {
@Autowired private final JobRepository jobRepository;
private JobRepository jobRepository; private final PlatformTransactionManager transactionManager;
@Autowired private final LoanAccrualsProcessingService loanAccrualsProcessingService;
private PlatformTransactionManager transactionManager;
@Autowired
private LoanAccrualsProcessingService loanAccrualsProcessingService;
@Bean @Bean
protected Step addPeriodicAccrualEntriesStep() { protected Step addPeriodicAccrualEntriesStep() {
@@ -18,6 +18,7 @@
*/ */
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsageing; package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsageing;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.jobs.service.JobName; import org.apache.fineract.infrastructure.jobs.service.JobName;
import org.springframework.batch.core.Job; import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step; import org.springframework.batch.core.Step;
@@ -25,21 +26,18 @@ import org.springframework.batch.core.job.builder.JobBuilder;
import org.springframework.batch.core.launch.support.RunIdIncrementer; import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.core.step.builder.StepBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
@Configuration @Configuration
@RequiredArgsConstructor
public class UpdateLoanArrearsAgeingConfig { public class UpdateLoanArrearsAgeingConfig {
@Autowired private final JobRepository jobRepository;
private JobRepository jobRepository; private final PlatformTransactionManager transactionManager;
@Autowired
private PlatformTransactionManager transactionManager;
@Autowired private final LoanArrearsAgeingUpdateHandler updateLoanArrearsAgingService;
private LoanArrearsAgeingUpdateHandler updateLoanArrearsAgingService;
@Bean @Bean
protected Step updateLoanArrearsAgeingStep() { protected Step updateLoanArrearsAgeingStep() {