vidakovic commented on code in PR #2281: URL: https://github.com/apache/fineract/pull/2281#discussion_r851114220
########## fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/data/InstanceTypeData.java: ########## @@ -0,0 +1,33 @@ +/** + * 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.configuration.data; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Data +@Configuration +@ConfigurationProperties(prefix = "fineract") +public class InstanceTypeData { Review Comment: That's going to clash a bit with "FineractProperties.java", because it has the same prefix. What I would do here instead is to define an inline class in FineractProperties... in the end it's just a utility class that's only used for configuration. That would look like this (sketching): ``` @Data @Configuration @ConfigurationProperties(prefix = "fineract") public class FineractProperties { // here all properties from Fineract private FineractModeProperties mode; @Data public static class FineractModeProperties { private boolean readEnabled; private boolean writeEnabled; private boolean batchEnabled; } } ``` ... which in turn translates then into the following properties: ``` fineract.mode.read-enabled=${FINERACT_MODE_READ_ENABLED:true} fineract.mode.write-enabled=${FINERACT_MODE_WRITE_ENABLED:true} fineract.mode.batch-enabled=${FINERACT_MODE_BATCH_ENABLED:true} ``` Advantages of this: - you keep the config/application.properties related classes together, namely FineractProperties and FineractModeProperties - consistent naming (prefix "Fineract", suffix "Properties"); then everyone knows what they are used for - I think we could even make FineractModeProperties package private; then no one can be tempted to use it in any other context than configuration - related concepts (I called it here "Mode", but doesn't really matter, could be anything else) are grouped with a kind of "namespace" (actually it's a prefix, here "fineract.mode.*"); once we have even more properties this will make life a lot easier and the FineractProperties class doesn't grow endlessly -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
