This is an automated email from the ASF dual-hosted git repository.

arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new 5b0ed4305 FINERACT-1932: Add custom Configuration class for 
self-savings module
5b0ed4305 is described below

commit 5b0ed43054d4e00775f1415c71970ca4372aee02
Author: Mohamed Magdi-Abdelmonem <[email protected]>
AuthorDate: Sat Sep 9 18:18:53 2023 +0300

    FINERACT-1932: Add custom Configuration class for self-savings module
---
 .../AppuserSavingsMapperReadServiceImpl.java       | 10 ++----
 .../savings/starter/SelfSavingsConfiguration.java  | 36 ++++++++++++++++++++++
 2 files changed, 38 insertions(+), 8 deletions(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/service/AppuserSavingsMapperReadServiceImpl.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/service/AppuserSavingsMapperReadServiceImpl.java
index 01e9e0f24..a81785996 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/service/AppuserSavingsMapperReadServiceImpl.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/service/AppuserSavingsMapperReadServiceImpl.java
@@ -18,20 +18,14 @@
  */
 package org.apache.fineract.portfolio.self.savings.service;
 
-import org.springframework.beans.factory.annotation.Autowired;
+import lombok.RequiredArgsConstructor;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.stereotype.Service;
 
-@Service
+@RequiredArgsConstructor
 public class AppuserSavingsMapperReadServiceImpl implements 
AppuserSavingsMapperReadService {
 
     private final JdbcTemplate jdbcTemplate;
 
-    @Autowired
-    public AppuserSavingsMapperReadServiceImpl(final JdbcTemplate 
jdbcTemplate) {
-        this.jdbcTemplate = jdbcTemplate;
-    }
-
     @Override
     public Boolean isSavingsMappedToUser(Long savingsId, Long appUserId) {
         return this.jdbcTemplate.queryForObject(
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/starter/SelfSavingsConfiguration.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/starter/SelfSavingsConfiguration.java
new file mode 100644
index 000000000..d304e7759
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/starter/SelfSavingsConfiguration.java
@@ -0,0 +1,36 @@
+/**
+ * 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.portfolio.self.savings.starter;
+
+import 
org.apache.fineract.portfolio.self.savings.service.AppuserSavingsMapperReadService;
+import 
org.apache.fineract.portfolio.self.savings.service.AppuserSavingsMapperReadServiceImpl;
+import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+@Configuration
+public class SelfSavingsConfiguration {
+
+    @Bean
+    @ConditionalOnMissingBean(AppuserSavingsMapperReadService.class)
+    public AppuserSavingsMapperReadService 
appuserSavingsMapperReadService(JdbcTemplate jdbcTemplate) {
+        return new AppuserSavingsMapperReadServiceImpl(jdbcTemplate);
+    }
+}

Reply via email to