zoukankan      html  css  js  c++  java
  • 以 nacos-spring-boot 看 spring-boot

    spring boot 的一个特点是,在 application.properties / yml 中配置后,配置项就会被解析,甚至创建 bean。

    还有一个特点是,通过 starter 管理了依赖项的版本。

    入口在 nacos-config-spring-boot-autoconfigure/META-INF/spring.factories

    org.springframework.boot.autoconfigure.EnableAutoConfiguration=
      com.alibaba.boot.nacos.config.autoconfigure.NacosConfigAutoConfiguration
    org.springframework.boot.env.EnvironmentPostProcessor=
      com.alibaba.boot.nacos.config.autoconfigure.NacosConfigEnvironmentProcessor

    自动解析配置,以及自动注册 bean 的逻辑

    @ConditionalOnProperty(name = NacosConfigConstants.ENABLED, matchIfMissing = true)
    @ConditionalOnMissingBean(name = CONFIG_GLOBAL_NACOS_PROPERTIES_BEAN_NAME)
    @EnableConfigurationProperties(value = NacosConfigProperties.class)
    @ConditionalOnClass(name = "org.springframework.boot.context.properties.bind.Binder")
    @Import(value = { NacosConfigBootBeanDefinitionRegistrar.class })
    @EnableNacosConfig
    public class NacosConfigAutoConfiguration {
    
    }

    拉取 nacos 远程配置的逻辑

    com.alibaba.boot.nacos.config.autoconfigure.NacosConfigEnvironmentProcessor
  • 相关阅读:
    LeetCode 485. Max Consecutive Ones
    LeetCode 367. Valid Perfect Square
    LeetCode 375. Guess Number Higher or Lower II
    LeetCode 374. Guess Number Higher or Lower
    LeetCode Word Pattern II
    LeetCode Arranging Coins
    LeetCode 422. Valid Word Square
    Session 共享
    java NIO
    非阻塞IO
  • 原文地址:https://www.cnblogs.com/allenwas3/p/12492723.html
Copyright © 2011-2022 走看看