FINERACT-1022: Fixing ehcache 3
This commit is contained in:
committed by
Yemdjih Kaze Nasser
parent
da978a37aa
commit
7d2c3ec417
@@ -72,6 +72,7 @@ dependencies {
|
|||||||
|
|
||||||
// JAX-B dependencies for JDK 9+
|
// JAX-B dependencies for JDK 9+
|
||||||
'jakarta.xml.bind:jakarta.xml.bind-api',
|
'jakarta.xml.bind:jakarta.xml.bind-api',
|
||||||
|
|
||||||
'org.dom4j:dom4j',
|
'org.dom4j:dom4j',
|
||||||
|
|
||||||
'javax.cache:cache-api',
|
'javax.cache:cache-api',
|
||||||
@@ -98,8 +99,9 @@ dependencies {
|
|||||||
implementation ('org.mnode.ical4j:ical4j') {
|
implementation ('org.mnode.ical4j:ical4j') {
|
||||||
exclude group: 'commons-logging'
|
exclude group: 'commons-logging'
|
||||||
}
|
}
|
||||||
implementation ('org.ehcache:ehcache') {
|
|
||||||
exclude group: 'org.glassfish.jaxb', module: 'jaxb-runtime'
|
runtimeOnly('org.ehcache:ehcache') {
|
||||||
|
exclude group: 'com.sun.activation'
|
||||||
}
|
}
|
||||||
|
|
||||||
// runtimeOnly dependencies are things that Fineract code has no direct compile time dependency on, but which must be present at run-time
|
// runtimeOnly dependencies are things that Fineract code has no direct compile time dependency on, but which must be present at run-time
|
||||||
@@ -129,6 +131,7 @@ dependencies {
|
|||||||
testImplementation ('io.rest-assured:rest-assured') {
|
testImplementation ('io.rest-assured:rest-assured') {
|
||||||
exclude group: 'commons-logging'
|
exclude group: 'commons-logging'
|
||||||
exclude group: 'org.apache.sling'
|
exclude group: 'org.apache.sling'
|
||||||
|
exclude group: 'com.sun.xml.bind'
|
||||||
}
|
}
|
||||||
testImplementation ('org.springframework.boot:spring-boot-starter-test') {
|
testImplementation ('org.springframework.boot:spring-boot-starter-test') {
|
||||||
exclude group: 'com.jayway.jsonpath', module: 'json-path'
|
exclude group: 'com.jayway.jsonpath', module: 'json-path'
|
||||||
|
|||||||
@@ -25,4 +25,3 @@ management.info.git.mode=FULL
|
|||||||
|
|
||||||
# FINERACT-914
|
# FINERACT-914
|
||||||
server.forward-headers-strategy=framework
|
server.forward-headers-strategy=framework
|
||||||
spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
|
|
||||||
|
|||||||
@@ -26,4 +26,3 @@ management.info.git.mode=FULL
|
|||||||
|
|
||||||
# FINERACT-914
|
# FINERACT-914
|
||||||
server.forward-headers-strategy=framework
|
server.forward-headers-strategy=framework
|
||||||
spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
|
|
||||||
|
|||||||
+8
@@ -27,6 +27,8 @@ import org.apache.fineract.infrastructure.cache.CacheEnumerations;
|
|||||||
import org.apache.fineract.infrastructure.cache.data.CacheData;
|
import org.apache.fineract.infrastructure.cache.data.CacheData;
|
||||||
import org.apache.fineract.infrastructure.cache.domain.CacheType;
|
import org.apache.fineract.infrastructure.cache.domain.CacheType;
|
||||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.Cache;
|
import org.springframework.cache.Cache;
|
||||||
import org.springframework.cache.CacheManager;
|
import org.springframework.cache.CacheManager;
|
||||||
@@ -43,6 +45,8 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component(value = "runtimeDelegatingCacheManager")
|
@Component(value = "runtimeDelegatingCacheManager")
|
||||||
public class RuntimeDelegatingCacheManager implements CacheManager {
|
public class RuntimeDelegatingCacheManager implements CacheManager {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(RuntimeDelegatingCacheManager.class);
|
||||||
|
|
||||||
private final JCacheCacheManager jcacheCacheManager;
|
private final JCacheCacheManager jcacheCacheManager;
|
||||||
private final CacheManager noOpCacheManager = new NoOpCacheManager();
|
private final CacheManager noOpCacheManager = new NoOpCacheManager();
|
||||||
private CacheManager currentCacheManager;
|
private CacheManager currentCacheManager;
|
||||||
@@ -106,6 +110,10 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
|
|||||||
clearEhCache();
|
clearEhCache();
|
||||||
}
|
}
|
||||||
this.currentCacheManager = this.jcacheCacheManager;
|
this.currentCacheManager = this.jcacheCacheManager;
|
||||||
|
|
||||||
|
if (this.currentCacheManager.getCacheNames().size() == 0) {
|
||||||
|
LOG.error("No caches configured for activated CacheManager {}", this.currentCacheManager);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MULTI_NODE:
|
case MULTI_NODE:
|
||||||
if (!distributedCacheEnabled) {
|
if (!distributedCacheEnabled) {
|
||||||
|
|||||||
+2
-2
@@ -27,8 +27,8 @@ import org.springframework.data.repository.query.Param;
|
|||||||
public interface ClientAddressRepository extends JpaRepository<ClientAddress, Long>, JpaSpecificationExecutor<ClientAddress> {
|
public interface ClientAddressRepository extends JpaRepository<ClientAddress, Long>, JpaSpecificationExecutor<ClientAddress> {
|
||||||
|
|
||||||
@Query("SELECT clientAddress FROM ClientAddress clientAddress WHERE clientAddress.client.id = :clientId AND clientAddress.addressType = :addressType AND clientAddress.isActive = :isActive ")
|
@Query("SELECT clientAddress FROM ClientAddress clientAddress WHERE clientAddress.client.id = :clientId AND clientAddress.addressType = :addressType AND clientAddress.isActive = :isActive ")
|
||||||
ClientAddress findByClientIdAndAddressTypeAndIsActive(@Param("clientId") final long clientId, final CodeValue addressType,
|
ClientAddress findByClientIdAndAddressTypeAndIsActive(@Param("clientId") final long clientId,
|
||||||
@Param("isActive") final boolean isActive);
|
@Param("addressType") final CodeValue addressType, @Param("isActive") final boolean isActive);
|
||||||
|
|
||||||
@Query("SELECT clientAddress FROM ClientAddress clientAddress WHERE clientAddress.client.id = :clientId AND clientAddress.address.id = :addressId ")
|
@Query("SELECT clientAddress FROM ClientAddress clientAddress WHERE clientAddress.client.id = :clientId AND clientAddress.address.id = :addressId ")
|
||||||
ClientAddress findByClientIdAndAddressId(@Param("clientId") final long clientId, @Param("addressId") final long addressId);
|
ClientAddress findByClientIdAndAddressId(@Param("clientId") final long clientId, @Param("addressId") final long addressId);
|
||||||
|
|||||||
@@ -34,6 +34,6 @@
|
|||||||
p:cacheManager-ref="ehcacheInstance" />
|
p:cacheManager-ref="ehcacheInstance" />
|
||||||
|
|
||||||
<bean id="ehcacheInstance"
|
<bean id="ehcacheInstance"
|
||||||
class="org.springframework.cache.jcache.JCacheManagerFactoryBean"/>
|
class="org.springframework.cache.jcache.JCacheManagerFactoryBean" p:cacheManagerUri="classpath:/META-INF/spring/ehcache.xml"/>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|||||||
@@ -24,33 +24,30 @@
|
|||||||
<config xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://www.ehcache.org/v3'
|
<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">
|
xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.7.xsd">
|
||||||
|
|
||||||
<defaultCache eternal="true" maxEntriesLocalHeap="100"
|
<cache-template name="defaultTemplate">
|
||||||
overflowToDisk="false" />
|
<expiry>
|
||||||
|
<none/>
|
||||||
|
</expiry>
|
||||||
|
<heap unit="entries">
|
||||||
|
10000
|
||||||
|
</heap>
|
||||||
|
</cache-template>
|
||||||
|
|
||||||
<cache name="users" maxEntriesLocalHeap="10000" eternal="true"
|
<cache alias="users" uses-template="defaultTemplate"/>
|
||||||
overflowToDisk="false" />
|
<cache alias="usersByUsername" uses-template="defaultTemplate"/>
|
||||||
<cache name="usersByUsername" maxEntriesLocalHeap="10000"
|
<cache alias="tenantsById" uses-template="defaultTemplate"/>
|
||||||
eternal="true" overflowToDisk="false" />
|
<cache alias="offices" uses-template="defaultTemplate"/>
|
||||||
<cache name="tenantsById" maxEntriesLocalHeap="10000" eternal="true"
|
<cache alias="officesForDropdown" uses-template="defaultTemplate"/>
|
||||||
overflowToDisk="false" />
|
<cache alias="officesById" uses-template="defaultTemplate"/>
|
||||||
<cache name="offices" maxEntriesLocalHeap="10000" eternal="true"
|
<cache alias="charges" uses-template="defaultTemplate"/>
|
||||||
overflowToDisk="false" />
|
<cache alias="funds" uses-template="defaultTemplate"/>
|
||||||
<cache name="officesForDropdown" maxEntriesLocalHeap="10000"
|
<cache alias="code_values" uses-template="defaultTemplate"/>
|
||||||
eternal="true" overflowToDisk="false" />
|
<cache alias="codes" uses-template="defaultTemplate"/>
|
||||||
<cache name="officesById" maxEntriesLocalHeap="10000" eternal="true"
|
<cache alias="hooks" uses-template="defaultTemplate"/>
|
||||||
overflowToDisk="false" />
|
<cache alias="tfConfig" uses-template="defaultTemplate"/>
|
||||||
<cache name="charges" maxEntriesLocalHeap="10000" eternal="true"
|
<cache alias="userTFAccessToken" uses-template="defaultTemplate">
|
||||||
overflowToDisk="false" />
|
<expiry>
|
||||||
<cache name="funds" maxEntriesLocalHeap="10000" eternal="true"
|
<tti unit="seconds">7200</tti>
|
||||||
overflowToDisk="false" />
|
</expiry>
|
||||||
<cache name="code_values" maxEntriesLocalHeap="10000" eternal="true"
|
</cache>
|
||||||
overflowToDisk="false" />
|
|
||||||
<cache name="codes" maxEntriesLocalHeap="10000" eternal="true"
|
|
||||||
overflowToDisk="false" />
|
|
||||||
<cache name="hooks" maxEntriesLocalHeap="10000" eternal="true"
|
|
||||||
overflowToDisk="false" />
|
|
||||||
<cache name="userTFAccessToken" maxEntriesLocalHeap="10000"
|
|
||||||
overflowToDisk="false" timeToIdleSeconds="7200" />
|
|
||||||
<cache name="tfConfig" maxEntriesLocalHeap="10000" eternal="true"
|
|
||||||
overflowToDisk="false" />
|
|
||||||
</config>
|
</config>
|
||||||
|
|||||||
Reference in New Issue
Block a user