FINERACT-1022: Fixing ehcache 3

This commit is contained in:
Petri Tuomola
2020-06-30 03:10:11 +01:00
committed by Yemdjih Kaze Nasser
parent da978a37aa
commit 7d2c3ec417
7 changed files with 41 additions and 35 deletions
@@ -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.domain.CacheType;
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.cache.Cache;
import org.springframework.cache.CacheManager;
@@ -43,6 +45,8 @@ import org.springframework.stereotype.Component;
@Component(value = "runtimeDelegatingCacheManager")
public class RuntimeDelegatingCacheManager implements CacheManager {
private static final Logger LOG = LoggerFactory.getLogger(RuntimeDelegatingCacheManager.class);
private final JCacheCacheManager jcacheCacheManager;
private final CacheManager noOpCacheManager = new NoOpCacheManager();
private CacheManager currentCacheManager;
@@ -106,6 +110,10 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
clearEhCache();
}
this.currentCacheManager = this.jcacheCacheManager;
if (this.currentCacheManager.getCacheNames().size() == 0) {
LOG.error("No caches configured for activated CacheManager {}", this.currentCacheManager);
}
break;
case MULTI_NODE:
if (!distributedCacheEnabled) {
@@ -27,8 +27,8 @@ import org.springframework.data.repository.query.Param;
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 ")
ClientAddress findByClientIdAndAddressTypeAndIsActive(@Param("clientId") final long clientId, final CodeValue addressType,
@Param("isActive") final boolean isActive);
ClientAddress findByClientIdAndAddressTypeAndIsActive(@Param("clientId") final long clientId,
@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 ")
ClientAddress findByClientIdAndAddressId(@Param("clientId") final long clientId, @Param("addressId") final long addressId);