vidakovic commented on code in PR #6387: URL: https://github.com/apache/fineract/pull/6387#discussion_r3979799423
########## fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/FineractApplicationLifecycleLogger.java: ########## @@ -0,0 +1,94 @@ +/** + * 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 lombok.extern.slf4j.Slf4j; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.boot.web.context.WebServerApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.event.ContextClosedEvent; +import org.springframework.context.event.EventListener; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class FineractApplicationLifecycleLogger { + + private volatile ConfigurableApplicationContext readyApplicationContext; + + @EventListener + public void onApplicationReady(ApplicationReadyEvent event) { + ConfigurableApplicationContext applicationContext = event.getApplicationContext(); + readyApplicationContext = applicationContext; + Environment environment = applicationContext.getEnvironment(); + log.info("Fineract lifecycle event: {}", createReadyMessage(environment, getServerPort(applicationContext))); Review Comment: Why would you extract `Environment` here and pass it then through a function call down to a lower level? Ah, I know... because you declared all these functions - unnecessarily - `static`... please don't, you are not saving anything here by declaring those functions static (if that was your intention). Note: the goal is to make the functions as simple as possible and that primarily means to make their signatures (read: number parameters) as low as possible. -- 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]
