All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tencent.bkrepo.common.service.cluster.ClusterConfiguration.kt Maven / Gradle / Ivy

package com.tencent.bkrepo.common.service.cluster

import com.tencent.bkrepo.common.service.util.SpringContextUtils
import org.slf4j.LoggerFactory
import org.springframework.boot.context.event.ApplicationStartedEvent
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
import org.springframework.context.event.EventListener

@Configuration
@EnableConfigurationProperties(ClusterProperties::class)
@Import(StandaloneJobAspect::class)
class ClusterConfiguration {

    @EventListener(ApplicationStartedEvent::class)
    fun logClusterProperties() {
        val clusterProperties = SpringContextUtils.getBean()
        with(clusterProperties) {
            logger.info("cluster start with properties: role=$role, region=$region, architecture=$architecture, " +
                "center.name=${center.name}, center.url=${center.url} " +
                "self.name=${self.name}, self.url=${self.url}")
        }
    }

    companion object {
        private val logger = LoggerFactory.getLogger(ClusterConfiguration::class.java)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy