diff --git a/config/fineractdev-formatter.xml b/config/fineractdev-formatter.xml
index 68b50c4b3..bedc59ca2 100644
--- a/config/fineractdev-formatter.xml
+++ b/config/fineractdev-formatter.xml
@@ -100,7 +100,7 @@
-
+
diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle
index 2ab246779..e51186890 100644
--- a/fineract-provider/dependencies.gradle
+++ b/fineract-provider/dependencies.gradle
@@ -106,7 +106,7 @@ dependencies {
exclude group: 'javax.activation'
}
- runtimeOnly('org.ehcache:ehcache') {
+ implementation ('org.ehcache:ehcache') {
exclude group: 'com.sun.activation'
}
diff --git a/fineract-provider/properties/basicauth/twofactor/application.properties b/fineract-provider/properties/basicauth/twofactor/application.properties
index a9b13cc5e..db33db991 100644
--- a/fineract-provider/properties/basicauth/twofactor/application.properties
+++ b/fineract-provider/properties/basicauth/twofactor/application.properties
@@ -21,6 +21,11 @@ spring.profiles.default=basicauth
spring.profiles.active=basicauth,twofactor
management.health.jms.enabled=false
+# FINERACT 1296
+management.endpoint.health.probes.enabled=true
+management.health.livenessState.enabled=true
+management.health.readinessState.enabled=true
+
# FINERACT-883
management.info.git.mode=FULL
diff --git a/fineract-provider/properties/oauth/application.properties b/fineract-provider/properties/oauth/application.properties
index fbe9c9f53..e08209a80 100644
--- a/fineract-provider/properties/oauth/application.properties
+++ b/fineract-provider/properties/oauth/application.properties
@@ -21,9 +21,13 @@ spring.profiles.default=basicauth
spring.profiles.active=oauth
management.health.jms.enabled=false
+# FINERACT 1296
+management.endpoint.health.probes.enabled=true
+management.health.livenessState.enabled=true
+management.health.readinessState.enabled=true
+
# FINERACT-883
management.info.git.mode=FULL
# FINERACT-914
server.forward-headers-strategy=framework
-spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
diff --git a/fineract-provider/properties/oauth/twofactor/application.properties b/fineract-provider/properties/oauth/twofactor/application.properties
index 4e4ecd39f..306cf1bd5 100644
--- a/fineract-provider/properties/oauth/twofactor/application.properties
+++ b/fineract-provider/properties/oauth/twofactor/application.properties
@@ -21,9 +21,13 @@ spring.profiles.default=basicauth
spring.profiles.active=oauth,twofactor
management.health.jms.enabled=false
+# FINERACT 1296
+management.endpoint.health.probes.enabled=true
+management.health.livenessState.enabled=true
+management.health.readinessState.enabled=true
+
# FINERACT-883
management.info.git.mode=FULL
# FINERACT-914
server.forward-headers-strategy=framework
-spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
diff --git a/fineract-provider/src/main/java/org/apache/fineract/ServerApplication.java b/fineract-provider/src/main/java/org/apache/fineract/ServerApplication.java
index aad208e5b..e2063518e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/ServerApplication.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/ServerApplication.java
@@ -26,7 +26,6 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;
-import org.springframework.context.annotation.ImportResource;
/**
* Fineract main() application which launches Fineract in an embedded Tomcat HTTP (using Spring Boot).
@@ -39,13 +38,11 @@ import org.springframework.context.annotation.ImportResource;
*
* It's the old/classic Mifos (non-X) Workspace 2.0 reborn for Fineract! ;-)
*
- * @see ServerWithMariaDB4jApplication for an alternative with an embedded DB
*/
public class ServerApplication extends SpringBootServletInitializer {
@Import({ EmbeddedTomcatWithSSLConfiguration.class })
- @ImportResource({ "classpath*:META-INF/spring/hikariDataSource.xml" })
private static class Configuration extends AbstractApplicationConfiguration {}
@Override
diff --git a/fineract-provider/src/main/java/org/apache/fineract/ServerWithMariaDB4jApplication.java b/fineract-provider/src/main/java/org/apache/fineract/ServerWithMariaDB4jApplication.java
deleted file mode 100644
index 3a6521de0..000000000
--- a/fineract-provider/src/main/java/org/apache/fineract/ServerWithMariaDB4jApplication.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract;
-
-import java.awt.Desktop;
-import java.io.IOException;
-import java.net.URI;
-
-import org.apache.fineract.infrastructure.core.boot.AbstractApplicationConfiguration;
-import org.apache.fineract.infrastructure.core.boot.ApplicationExitUtil;
-import org.apache.fineract.infrastructure.core.boot.EmbeddedTomcatWithSSLConfiguration;
-import org.apache.fineract.infrastructure.core.boot.db.MariaDB4jDataSourceConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.SpringApplication;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.annotation.Import;
-import org.springframework.core.io.Resource;
-
-/**
- * Fineract main() application which launches Fineract in an embedded Tomcat HTTP
- * server (using Spring Boot), as well as an embedded database (using
- * MariaDB4j).
- *
- * You can easily launch this via Debug as Java Application in your IDE -
- * without needing command line Gradle stuff, no need to build and deploy a WAR,
- * remote attachment etc.
- *
- * It's the old/classic Mifos (non-X) Workspace 2.0 reborn for Fineract! ;-)
- *
- * @see ServerApplication for the same without the embedded MariaDB4j database
- */
-public class ServerWithMariaDB4jApplication {
- private final static Logger LOG = LoggerFactory.getLogger(ServerWithMariaDB4jApplication.class);
-
- @Import({ MariaDB4jDataSourceConfiguration.class, EmbeddedTomcatWithSSLConfiguration.class })
- public static class Configuration extends AbstractApplicationConfiguration { }
-
- public static void main(String[] args) throws Exception {
- ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args);
- if (!Desktop.isDesktopSupported()) {
- LOG.info("Not going to open UI homepage in local web browser, because !Desktop.isDesktopSupported()");
-
- } else {
- // apps/community-app/dist/community-app/index.html
- Resource distResource = ctx.getResource("file:" + System.getProperty("user.dir") +
- System.getProperty("file.separator") + "apps" +
- System.getProperty("file.separator") + "community-app" +
- System.getProperty("file.separator") + "dist" +
- System.getProperty("file.separator") + "community-app" +
- System.getProperty("file.separator") + "index.html");
- URI distURI = URI.create("https://localhost:8443/fineract-provider" +
- "/apps/community-app/index.html?baseApiUrl=https://localhost:8443" +
- "&tenantIdentifier=default#/");
-
- // apps/community-app/app/index.html
- Resource devResource = ctx.getResource("file:" + System.getProperty("user.dir") +
- System.getProperty("file.separator") + "apps" +
- System.getProperty("file.separator") + "community-app" +
- System.getProperty("file.separator") + "app" +
- System.getProperty("file.separator") + "index.html");
- URI devURI = URI.create("https://localhost:8443/fineract-provider" +
- "/apps/community-app/app/index.html?baseApiUrl=https://localhost:8443" +
- "&tenantIdentifier=default#/");
-
- if (distResource.exists()) {
- openWebBrowser(distURI);
- } else if (devResource.exists()) {
- openWebBrowser(devURI);
- } else {
- LOG.error("Cannot open Fineract UI in browser; not found: " + distResource.toString());
- }
- }
-
- // TODO Tray Icon stuff; dig out my very own old @see https://github.com/mifos/head/tree/hudsonBuild-MIFOS-5157_Launch4j-EXE_NewDist-squash1/server-jetty/src/main/java/org/mifos/server/tray
-
- ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
- }
-
- private static void openWebBrowser(URI uri) {
- try {
- LOG.info("Opening Fineract UI in browser: " + uri.toString());
- Desktop.getDesktop().browse(uri);
- } catch (IOException e) {
- LOG.error("IOException when opening Fineract UI in browser: " + uri.toString(), e);
- }
- }
-
-}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/PlatformCacheConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/PlatformCacheConfiguration.java
index 0712cff1f..742a7d3e7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/PlatformCacheConfiguration.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/PlatformCacheConfiguration.java
@@ -22,18 +22,14 @@ import org.apache.fineract.infrastructure.cache.service.RuntimeDelegatingCacheMa
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurer;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.cache.interceptor.CacheErrorHandler;
-import org.springframework.cache.interceptor.CacheResolver;
-import org.springframework.cache.interceptor.KeyGenerator;
-import org.springframework.cache.interceptor.SimpleKeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-@SuppressWarnings("deprecation")
@Configuration
@EnableCaching
-public class PlatformCacheConfiguration implements CachingConfigurer {
+public class PlatformCacheConfiguration extends CachingConfigurerSupport implements CachingConfigurer {
@Autowired
private RuntimeDelegatingCacheManager delegatingCacheManager;
@@ -43,21 +39,4 @@ public class PlatformCacheConfiguration implements CachingConfigurer {
public CacheManager cacheManager() {
return this.delegatingCacheManager;
}
-
- @Override
- public CacheResolver cacheResolver() {
- // TODO https://issues.apache.org/jira/browse/FINERACT-705
- return null;
- }
-
- @Override
- public KeyGenerator keyGenerator() {
- return new SimpleKeyGenerator();
- }
-
- @Override
- public CacheErrorHandler errorHandler() {
- // TODO https://issues.apache.org/jira/browse/FINERACT-705
- return null;
- }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/service/RuntimeDelegatingCacheManager.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/service/RuntimeDelegatingCacheManager.java
index af9e412d1..74225c103 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/service/RuntimeDelegatingCacheManager.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/service/RuntimeDelegatingCacheManager.java
@@ -47,13 +47,13 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
private static final Logger LOG = LoggerFactory.getLogger(RuntimeDelegatingCacheManager.class);
- private final JCacheCacheManager jcacheCacheManager;
+ private final CacheManager cacheManager;
private final CacheManager noOpCacheManager = new NoOpCacheManager();
private CacheManager currentCacheManager;
@Autowired
- public RuntimeDelegatingCacheManager(final JCacheCacheManager jcacheCacheManager) {
- this.jcacheCacheManager = jcacheCacheManager;
+ public RuntimeDelegatingCacheManager(final JCacheCacheManager cacheManager) {
+ this.cacheManager = cacheManager;
this.currentCacheManager = this.noOpCacheManager;
}
@@ -109,7 +109,7 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
changes.put(CacheApiConstants.cacheTypeParameter, toCacheType.getValue());
clearEhCache();
}
- this.currentCacheManager = this.jcacheCacheManager;
+ this.currentCacheManager = this.cacheManager;
if (this.currentCacheManager.getCacheNames().size() == 0) {
LOG.error("No caches configured for activated CacheManager {}", this.currentCacheManager);
@@ -126,7 +126,6 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
}
private void clearEhCache() {
- javax.cache.CacheManager cacheManager = this.jcacheCacheManager.getCacheManager();
Iterable cacheNames = cacheManager.getCacheNames();
for (String cacheName : cacheNames) {
cacheManager.getCache(cacheName).clear();
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/AbstractApplicationConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/AbstractApplicationConfiguration.java
index ad57cfefd..1f9d0a8f7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/AbstractApplicationConfiguration.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/AbstractApplicationConfiguration.java
@@ -18,7 +18,6 @@
*/
package org.apache.fineract.infrastructure.core.boot;
-import org.apache.fineract.notification.config.MessagingConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
@@ -26,33 +25,24 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
-import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
- * Base Spring Configuration with what's common to all Configuration subclasses.
- *
- * Notably the EnableAutoConfiguration excludes relevant for (and often adjusted when upgrading versions of) Spring
- * Boot, the "old" (pre. Spring Boot & MariaDB4j) fineract appContext.xml which all configurations need, and the
- * web.xml successor WebXmlConfiguration.
- *
- * Should NOT include Configuration related to embedded Tomcat, data sources, and MariaDB4j (because those differ in the
- * subclasses).
+ * Base Spring Configuration. Excludes autoconfiguration for those things we want to manually configure.
*/
+
@Configuration
-@Import({ WebXmlConfiguration.class, WebXmlOauthConfiguration.class, WebFrontEndConfiguration.class, MessagingConfiguration.class,
- WebTwoFactorXmlConfiguration.class, JerseyConfig.class })
-@ImportResource({ "classpath*:META-INF/spring/appContext.xml" })
@PropertySource(value = "classpath:META-INF/spring/jdbc.properties")
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class, FlywayAutoConfiguration.class, GsonAutoConfiguration.class,
JdbcTemplateAutoConfiguration.class })
-@EnableWebSecurity
@EnableTransactionManagement
+@EnableWebSecurity
+@ComponentScan(basePackages = "org.apache.fineract.**")
public abstract class AbstractApplicationConfiguration {
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebTwoFactorXmlConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebTwoFactorXmlConfiguration.java
deleted file mode 100644
index 086ffe521..000000000
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebTwoFactorXmlConfiguration.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.infrastructure.core.boot;
-
-import org.apache.fineract.infrastructure.security.filter.TwoFactorAuthenticationFilter;
-import org.springframework.boot.web.servlet.FilterRegistrationBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-public class WebTwoFactorXmlConfiguration {
-
- @Bean
- public FilterRegistrationBean twoFactorFilterBean(TwoFactorAuthenticationFilter filter) {
- FilterRegistrationBean registrationBean = new FilterRegistrationBean(
- filter);
- registrationBean.setEnabled(false);
- return registrationBean;
- }
-}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlConfiguration.java
deleted file mode 100644
index 4cb1e446a..000000000
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlConfiguration.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.infrastructure.core.boot;
-
-import org.apache.fineract.infrastructure.security.filter.TenantAwareBasicAuthenticationFilter;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.web.servlet.FilterRegistrationBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Profile;
-
-/**
- * This Configuration replaces what formerly was in web.xml.
- *
- * @see #howto-convert-an-existing-application-to-spring-boot
- */
-@Configuration
-@Profile("basicauth")
-public class WebXmlConfiguration {
-
- @Autowired
- private TenantAwareBasicAuthenticationFilter basicAuthenticationProcessingFilter;
-
- @Bean
- public FilterRegistrationBean filterRegistrationBean() {
- FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
- filterRegistrationBean.setFilter(basicAuthenticationProcessingFilter);
- filterRegistrationBean.setEnabled(false);
- return filterRegistrationBean;
- }
-
-}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/db/MariaDB4jDataSourceConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/db/MariaDB4jDataSourceConfiguration.java
deleted file mode 100644
index f1992fd3d..000000000
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/db/MariaDB4jDataSourceConfiguration.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.infrastructure.core.boot.db;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
-
-@Configuration
-public class MariaDB4jDataSourceConfiguration extends DataSourceConfiguration {
-
- @Bean
- public MariaDB4jSetupService mariaDB4jSetUp() {
- return new MariaDB4jSetupService(mariaDB4j().getDB());
- }
-
- @Bean
- public MariaDB4jSpringService mariaDB4j() {
- MariaDB4jSpringService mariaDB4jSpringService = new MariaDB4jSpringService();
- mariaDB4jSpringService.setDefaultBaseDir("build/db/bin");
- mariaDB4jSpringService.setDefaultDataDir("build/db/data");
- return mariaDB4jSpringService;
- }
-
- @Override
- // NOT @Bean @Override dataSourceProperties() - doesn't work :(
- protected DataSourceProperties getProperties() {
- DataSourceProperties p = super.getProperties();
- String dbName = mariaDB4jSetUp().getTenantDBName();
- // Do not use p.setUrl(mariaDB4j().getConfiguration().getURL(dbName));
- // Because TenantDataSourcePortFixService needs separate
- // host/port/db/uid/pwd:
- // (DataSourceProperties getUrl() creates the correct JDBC URL from it)
- // This intentionally overrides any fineract.datasource.* settings, because
- // in this configuration, logically the mariaDB4j settings take
- // precedence:
- p.setHost("localhost");
- p.setPort(mariaDB4j().getConfiguration().getPort());
- p.setDBName(dbName);
- // TODO p.setUsername(mariaDB4j().getConfiguration().getUsername());
- // TODO p.setPassword(mariaDB4j().getConfiguration().getPassword());
- return p;
- }
-
-}
\ No newline at end of file
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/db/MariaDB4jSetupService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/db/MariaDB4jSetupService.java
deleted file mode 100644
index 877dbc27c..000000000
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/db/MariaDB4jSetupService.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.infrastructure.core.boot.db;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import ch.vorburger.exec.ManagedProcessException;
-import ch.vorburger.mariadb4j.DB;
-
-public class MariaDB4jSetupService {
-
- private DB db;
-
- @Autowired
- public MariaDB4jSetupService(DB db) {
- this.db = db;
- }
-
- @PostConstruct
- protected void setUpDBs() throws ManagedProcessException {
- db.createDB(getTenantDBName());
- db.createDB("fineract_default");
- // Note that we don't need to initialize the DBs, because
- // the TenantDatabaseUpgradeService will do this in just a moment.
- }
-
- public String getTenantDBName() {
- return "fineract_tenants";
- }
-
- @PreDestroy
- protected void stop() throws ManagedProcessException {
- db = null;
- }
-}
\ No newline at end of file
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/CacheConfig.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/CacheConfig.java
new file mode 100644
index 000000000..e6117fa68
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/CacheConfig.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.fineract.infrastructure.core.config;
+
+import java.time.Duration;
+import javax.cache.CacheManager;
+import javax.cache.Caching;
+import javax.cache.spi.CachingProvider;
+import org.ehcache.config.builders.CacheConfigurationBuilder;
+import org.ehcache.config.builders.ExpiryPolicyBuilder;
+import org.ehcache.config.builders.ResourcePoolsBuilder;
+import org.ehcache.jsr107.Eh107Configuration;
+import org.springframework.cache.jcache.JCacheCacheManager;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class CacheConfig {
+
+ @Bean
+ public JCacheCacheManager ehCacheManager() {
+ JCacheCacheManager jCacheCacheManager = new JCacheCacheManager();
+ jCacheCacheManager.setCacheManager(getCustomCacheManager());
+ return jCacheCacheManager;
+ }
+
+ private CacheManager getCustomCacheManager() {
+ CachingProvider provider = Caching.getCachingProvider();
+ CacheManager cacheManager = provider.getCacheManager();
+
+ javax.cache.configuration.Configuration