oleksii-novikov-onix commented on code in PR #4172:
URL: https://github.com/apache/fineract/pull/4172#discussion_r1871297865


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/LoanAccountConfiguration.java:
##########
@@ -389,13 +408,47 @@ public ReplayedTransactionBusinessEventService 
replayedTransactionBusinessEventS
     @Bean
     @ConditionalOnMissingBean(LoanDownPaymentHandlerService.class)
     public LoanDownPaymentHandlerService 
loanDownPaymentHandlerService(LoanTransactionRepository 
loanTransactionRepository,
-            BusinessEventNotifierService businessEventNotifierService) {
-        return new 
LoanDownPaymentHandlerServiceImpl(loanTransactionRepository, 
businessEventNotifierService);
+            BusinessEventNotifierService businessEventNotifierService,
+            LoanDownPaymentTransactionValidator 
loanDownPaymentTransactionValidator, LoanScheduleService loanScheduleService,
+            LoanRefundService loanRefundService, LoanRefundValidator 
loanRefundValidator) {
+        return new 
LoanDownPaymentHandlerServiceImpl(loanTransactionRepository, 
businessEventNotifierService,
+                loanDownPaymentTransactionValidator, loanScheduleService, 
loanRefundService, loanRefundValidator);
     }
 
     @Bean
     @ConditionalOnMissingBean(LoanDisbursementDetailsAssembler.class)
     public LoanDisbursementDetailsAssembler 
loanDisbursementDetailsAssembler(FromJsonHelper fromApiJsonHelper) {
         return new LoanDisbursementDetailsAssembler(fromApiJsonHelper);
     }
+
+    @Bean
+    @ConditionalOnMissingBean(LoanDisbursementService.class)

Review Comment:
   It seems the recommended way is to use @ConditionalOnMissingBean with 
configuration classes. From the 
[documentation](https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.html)
 of the ConditionalOnMissingBean class:
   
   > The condition can only match the bean definitions that have been processed 
by the application context so far and, as such, it is strongly recommended to 
use this condition on auto-configuration classes only. If a candidate bean may 
be created by another auto-configuration, make sure that the one using this 
condition runs after.
   
   I  think we can learn about it in depth, but at the moment with code
   ```
   @Service
   @ConditionalOnMissingBean(LoanDisbursementService.class)
   @RequiredArgsConstructor
   public class LoanDisbursementService {
   ```
   I have the next error:
   ```
   Parameter 20 of constructor in 
org.apache.fineract.portfolio.loanaccount.loanschedule.service.LoanScheduleAssembler
 
   required a bean of type 
'org.apache.fineract.portfolio.loanaccount.service.LoanDisbursementService'
   that could not be found.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to