FINERACT-1022 - Update to org.ehcache
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
17cb620ec0
commit
ca97a37544
@@ -94,7 +94,7 @@ dependencyManagement {
|
||||
dependency 'org.flywaydb:flyway-core:6.4.4'
|
||||
dependency 'org.quartz-scheduler:quartz:2.3.2'
|
||||
dependency 'com.amazonaws:aws-java-sdk-s3:1.11.800'
|
||||
dependency 'net.sf.ehcache:ehcache:2.10.6' // TODO FINERACT-1018
|
||||
dependency 'org.ehcache:ehcache:3.8.1'
|
||||
dependency 'com.github.spullara.mustache.java:compiler:0.9.6'
|
||||
dependency 'com.jayway.jsonpath:json-path:2.4.0'
|
||||
dependency 'org.apache.tika:tika-core:1.24.1'
|
||||
@@ -110,6 +110,7 @@ dependencyManagement {
|
||||
dependency 'io.github.classgraph:classgraph:4.8.85'
|
||||
dependency 'org.awaitility:awaitility:4.0.3'
|
||||
dependency 'com.github.spotbugs:spotbugs-annotations:4.0.4'
|
||||
dependency 'javax.cache:cache-api:1.1.1'
|
||||
|
||||
dependency ('org.dom4j:dom4j:2.1.3') {
|
||||
exclude 'relaxngDatatype:relaxngDatatype' // already in com.sun.xml.bind:jaxb-osgi:2.3.0.1
|
||||
|
||||
@@ -33,6 +33,7 @@ dependencies {
|
||||
|
||||
'org.springframework.boot:spring-boot-starter-web',
|
||||
'org.springframework.boot:spring-boot-starter-security',
|
||||
'org.springframework.boot:spring-boot-starter-cache',
|
||||
|
||||
'org.springframework:spring-jms',
|
||||
'org.springframework:spring-context-support',
|
||||
@@ -65,7 +66,6 @@ dependencies {
|
||||
'org.drizzle.jdbc:drizzle-jdbc',
|
||||
'org.flywaydb:flyway-core',
|
||||
|
||||
'net.sf.ehcache:ehcache',
|
||||
'com.github.librepdf:openpdf',
|
||||
'com.github.spullara.mustache.java:compiler',
|
||||
'com.jayway.jsonpath:json-path',
|
||||
@@ -74,6 +74,8 @@ dependencies {
|
||||
'jakarta.xml.bind:jakarta.xml.bind-api',
|
||||
'org.dom4j:dom4j',
|
||||
|
||||
'javax.cache:cache-api',
|
||||
|
||||
'com.github.spotbugs:spotbugs-annotations',
|
||||
)
|
||||
implementation ('io.swagger:swagger-jersey-jaxrs') {
|
||||
@@ -98,6 +100,9 @@ dependencies {
|
||||
implementation ('org.mnode.ical4j:ical4j') {
|
||||
exclude group: 'commons-logging'
|
||||
}
|
||||
implementation ('org.ehcache:ehcache') {
|
||||
exclude group: 'org.glassfish.jaxb', module: 'jaxb-runtime'
|
||||
}
|
||||
|
||||
// runtimeOnly dependencies are things that Fineract code has no direct compile time dependency on, but which must be present at run-time
|
||||
runtimeOnly(
|
||||
|
||||
@@ -25,3 +25,4 @@ management.info.git.mode=FULL
|
||||
|
||||
# FINERACT-914
|
||||
server.forward-headers-strategy=framework
|
||||
spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
|
||||
|
||||
@@ -26,3 +26,4 @@ management.info.git.mode=FULL
|
||||
|
||||
# FINERACT-914
|
||||
server.forward-headers-strategy=framework
|
||||
spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
|
||||
|
||||
@@ -25,4 +25,5 @@ management.health.jms.enabled=false
|
||||
management.info.git.mode=FULL
|
||||
|
||||
# FINERACT-914
|
||||
server.forward-headers-strategy=framework
|
||||
server.forward-headers-strategy=framework
|
||||
spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
|
||||
@@ -26,3 +26,4 @@ management.info.git.mode=FULL
|
||||
|
||||
# FINERACT-914
|
||||
server.forward-headers-strategy=framework
|
||||
spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
|
||||
|
||||
+11
-7
@@ -30,7 +30,7 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.ehcache.EhCacheCacheManager;
|
||||
import org.springframework.cache.jcache.JCacheCacheManager;
|
||||
import org.springframework.cache.support.NoOpCacheManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -45,13 +45,13 @@ import org.springframework.stereotype.Component;
|
||||
@Component(value = "runtimeDelegatingCacheManager")
|
||||
public class RuntimeDelegatingCacheManager implements CacheManager {
|
||||
|
||||
private final EhCacheCacheManager ehcacheCacheManager;
|
||||
private final JCacheCacheManager jcacheCacheManager;
|
||||
private final CacheManager noOpCacheManager = new NoOpCacheManager();
|
||||
private CacheManager currentCacheManager;
|
||||
|
||||
@Autowired
|
||||
public RuntimeDelegatingCacheManager(final EhCacheCacheManager ehcacheCacheManager) {
|
||||
this.ehcacheCacheManager = ehcacheCacheManager;
|
||||
public RuntimeDelegatingCacheManager(final JCacheCacheManager jcacheCacheManager) {
|
||||
this.jcacheCacheManager = jcacheCacheManager;
|
||||
this.currentCacheManager = this.noOpCacheManager;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
|
||||
public Collection<CacheData> retrieveAll() {
|
||||
|
||||
final boolean noCacheEnabled = this.currentCacheManager instanceof NoOpCacheManager;
|
||||
final boolean ehcacheEnabled = this.currentCacheManager instanceof EhCacheCacheManager;
|
||||
final boolean ehcacheEnabled = this.currentCacheManager instanceof JCacheCacheManager;
|
||||
|
||||
// final boolean distributedCacheEnabled = false;
|
||||
|
||||
@@ -107,7 +107,7 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
|
||||
changes.put(CacheApiConstants.cacheTypeParameter, toCacheType.getValue());
|
||||
clearEhCache();
|
||||
}
|
||||
this.currentCacheManager = this.ehcacheCacheManager;
|
||||
this.currentCacheManager = this.jcacheCacheManager;
|
||||
break;
|
||||
case MULTI_NODE:
|
||||
if (!distributedCacheEnabled) {
|
||||
@@ -120,6 +120,10 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
|
||||
}
|
||||
|
||||
private void clearEhCache() {
|
||||
this.ehcacheCacheManager.getCacheManager().clearAll();
|
||||
javax.cache.CacheManager cacheManager = this.jcacheCacheManager.getCacheManager();
|
||||
Iterable<String> cacheNames = cacheManager.getCacheNames();
|
||||
for (String cacheName: cacheNames) {
|
||||
cacheManager.getCache(cacheName).clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.organisation.monetary.domain;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import javax.annotation.PostConstruct;
|
||||
import net.sf.ehcache.util.FindBugsSuppressWarnings;
|
||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -40,7 +40,7 @@ public class MoneyHelper {
|
||||
|
||||
@PostConstruct
|
||||
// This is a hack, but fixing this is not trivial, because some @Entity domain classes use this helper
|
||||
@FindBugsSuppressWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
|
||||
@SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
|
||||
public void someFunction () {
|
||||
staticConfigurationDomainService = configurationDomainService;
|
||||
}
|
||||
|
||||
+3
-3
@@ -18,13 +18,13 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.loanproduct.data;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.sf.ehcache.util.FindBugsSuppressWarnings;
|
||||
import org.apache.fineract.accounting.common.AccountingEnumerations;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
@@ -1160,12 +1160,12 @@ public class LoanProductData implements Serializable {
|
||||
return null;
|
||||
}
|
||||
|
||||
@FindBugsSuppressWarnings("NP_BOOLEAN_RETURN_NULL")
|
||||
@SuppressFBWarnings("NP_BOOLEAN_RETURN_NULL")
|
||||
public Boolean isCompoundingToBePostedAsTransaction() {
|
||||
return isInterestRecalculationEnabled() ? this.interestRecalculationData.isCompoundingToBePostedAsTransaction() : null;
|
||||
}
|
||||
|
||||
@FindBugsSuppressWarnings("NP_BOOLEAN_RETURN_NULL")
|
||||
@SuppressFBWarnings("NP_BOOLEAN_RETURN_NULL")
|
||||
public Boolean allowCompoundingOnEod() {
|
||||
return isInterestRecalculationEnabled() ? this.interestRecalculationData.allowCompoundingOnEod() : null;
|
||||
}
|
||||
|
||||
@@ -30,11 +30,10 @@
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
|
||||
|
||||
<bean id="ehcacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
|
||||
<bean id="ehcacheManager" class="org.springframework.cache.jcache.JCacheCacheManager"
|
||||
p:cacheManager-ref="ehcacheInstance" />
|
||||
|
||||
<bean id="ehcacheInstance"
|
||||
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
|
||||
p:configLocation="classpath:/META-INF/spring/ehcache.xml" p:shared="true" />
|
||||
class="org.springframework.cache.jcache.JCacheManagerFactoryBean"/>
|
||||
|
||||
</beans>
|
||||
@@ -21,8 +21,9 @@
|
||||
-->
|
||||
|
||||
|
||||
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">
|
||||
<config xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://www.ehcache.org/v3'
|
||||
xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.7.xsd">
|
||||
|
||||
<defaultCache eternal="true" maxEntriesLocalHeap="100"
|
||||
overflowToDisk="false" />
|
||||
|
||||
@@ -52,4 +53,4 @@
|
||||
overflowToDisk="false" timeToIdleSeconds="7200" />
|
||||
<cache name="tfConfig" maxEntriesLocalHeap="10000" eternal="true"
|
||||
overflowToDisk="false" />
|
||||
</ehcache>
|
||||
</config>
|
||||
Reference in New Issue
Block a user