adamsaghy commented on code in PR #4861:
URL: https://github.com/apache/fineract/pull/4861#discussion_r2209903796
##########
fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/MoneyHelper.java:
##########
@@ -22,17 +22,20 @@
import jakarta.annotation.PostConstruct;
import java.math.MathContext;
import java.math.RoundingMode;
+import java.util.concurrent.ConcurrentHashMap;
import lombok.extern.slf4j.Slf4j;
import
org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
+import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
+import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class MoneyHelper {
- private static RoundingMode roundingMode = null;
- private static MathContext mathContext;
+ private static final ConcurrentHashMap<String, RoundingMode>
roundingModeCache = new ConcurrentHashMap<>();
+ private static final ConcurrentHashMap<String, MathContext>
mathContextCache = new ConcurrentHashMap<>();
public static final int PRECISION = 19;
private static ConfigurationDomainService staticConfigurationDomainService;
Review Comment:
I was wondering whether we could remove the `ConfigurationDomainService` all
together and remove `@Component` also.
This could be a utility class which is instantiated with values during the
startup:
- Not managed bean
- No any injections
- Value holder only
- Once instance got started, for each tenants automatically we set the value
What do you think?
--
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]