You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/03/26 06:06:19 UTC

[GitHub] [fineract] vidakovic opened a new pull request #2188: FINERACT-1550: Fix repetitive JdbcTemplate/RoutingDataSource injection

vidakovic opened a new pull request #2188:
URL: https://github.com/apache/fineract/pull/2188


   We are creating a lot of JdbcTemplate instances just to ensure that we use RoutingDataSource with it. It's way easier to do this once in a Spring Java config class and then just inject the JdbcTemplate. I'm not entirely sure what impact this change will have on memory usage, doing 150x `new JdbcTemplate(...)` must have an effect.
   
   In a couple of places the data source object wsa stored in service classes, but never used. I cleaned this up.
   
   Another nice side effect of this cleanup action: we are *NOTE* exposing any internal details (RoutingDataSource)  in our ser


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] IOhacker commented on pull request #2188: FINERACT-1550: Fix repetitive JdbcTemplate/RoutingDataSource injection

Posted by GitBox <gi...@apache.org>.
IOhacker commented on pull request #2188:
URL: https://github.com/apache/fineract/pull/2188#issuecomment-1079844848


   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vidakovic commented on pull request #2188: FINERACT-1550: Fix repetitive JdbcTemplate/RoutingDataSource injection

Posted by GitBox <gi...@apache.org>.
vidakovic commented on pull request #2188:
URL: https://github.com/apache/fineract/pull/2188#issuecomment-1079751036


   Alright... the cancelled build yesterday was only a hiccup on Github Actions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vidakovic merged pull request #2188: FINERACT-1550: Fix repetitive JdbcTemplate/RoutingDataSource injection

Posted by GitBox <gi...@apache.org>.
vidakovic merged pull request #2188:
URL: https://github.com/apache/fineract/pull/2188


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] galovics commented on a change in pull request #2188: FINERACT-1550: Fix repetitive JdbcTemplate/RoutingDataSource injection

Posted by GitBox <gi...@apache.org>.
galovics commented on a change in pull request #2188:
URL: https://github.com/apache/fineract/pull/2188#discussion_r835741464



##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JdbcConfig.java
##########
@@ -0,0 +1,42 @@
+/**
+ * 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 org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+
+@Configuration
+public class JdbcConfig {
+
+    @Bean
+    @Primary

Review comment:
       Question, is the @Primary really needed or it's just for safety?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vidakovic commented on a change in pull request #2188: FINERACT-1550: Fix repetitive JdbcTemplate/RoutingDataSource injection

Posted by GitBox <gi...@apache.org>.
vidakovic commented on a change in pull request #2188:
URL: https://github.com/apache/fineract/pull/2188#discussion_r835744497



##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JdbcConfig.java
##########
@@ -0,0 +1,42 @@
+/**
+ * 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 org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+
+@Configuration
+public class JdbcConfig {
+
+    @Bean
+    @Primary

Review comment:
       Nothing escapes your eyes ;-) ... yes, just for safety, but I'll actually try to remove before final approval, I think it should work... the slimmer the better.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org