Springboot + Nacos Dynamic Configuration - Personal Notes

tags: Personal notes

Packet

Version you choose

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>

NACOS configuration file

bootstrap.yml

Bootstrap.yml is preferred than Application.yml

Springboot configuration file

spring:
  application:
    name: cca-admin-service
  profiles:
    active: test
  cloud:
    nacos:
      server-addr: #nacos address
      config:
        enabled: true
        file-extension: yml
        refresh-enabled: true
        namespace: cca
        extension-configs:
          - data-id: api-common.yml
            refresh: true
          - data-id: redis.yml
            refresh: true
          - data-id: arango.yml
            refresh: true
          - data-id: rabbitmq.yml
            refresh: true
      discovery:
        enabled: true
        namespace: cca
        ip: admin.${spring.profiles.active}.cca.pub
        service: CCA-ADMIN-SERVICE

Intelligent Recommendation

@ScHEDuled scheduling tasks in Springboot Dynamic Modification Based on NACOS Configuration

Spring frameworks come from 3.0, with task scheduling feature, it is a lightweight quartz, and it is convenient, simple, and does not need to rely on other JAR packets. It is more convenient to use in...

SpringBoot Dynamic Get Value from NACOS Configuration Center in Static Method

Most of the online part of this part is some of the needs that do not meet my needs, what @Value () and @configurationproperties are got, and the conflict of the version, they have tried it, tortured ...

SpringBoot dynamic data source switch (NACOS configuration center)

Articles directory Foreword 1 Project file structure 2 Configuration file and pom.xml file 2.1 pom.xml 2.2 bootstrap.yml 2.3 Configuration in nacos 3 java file content 3.1 ORG.Feng.DataSource 3.1.1 Dy...

SpringBoot integrates NACOS configuration center to achieve dynamic refresh

Create Spring Boot project Add pom dependencies Start nacos and add environmental configuration files Modify bootstrap.yaml and start Spring Boot 1. Create Spring BOOT project Here is a new Maven proj...

SpringBoot integrates nacos dynamic reading configuration file and service discovery

1. Integrated NACOS 1) Configure pom file 2) Modify the configuration file nacos defaults to read the bootstrap.xml file 3) Configuration in the NACOS management interface 1. Create new namespace 2. N...

More Recommendation

Java SpringBoot local debugging dynamic modification NACOS configuration information

、 nacos, nacos , 。 ? You can modify it when you start the NACOS configuration at the local SpringBoot project. 2. Take an example For example:The server.tomcat.basedir configuration configured in NACO...

Personal notes of SpringBoot hot deployment configuration

Hot deployment of SpringBoot 1. Add dependency in pom file: 2. Add the plug-in to the pom file: 3.yml file configuration Pay attention to each level to be aligned, bold and careful. 4. Modify global s...

001. Nacos dynamic configuration

1. NACOS download and start NACOS official website document SpringCloudAlibaba official website document Reference 1. NACOS download I won’t explain what NACOS is. Follow the Quick Star steps on...

Nacos dynamic configuration management

See:https://nacos.io/zh-cn/docs/quick-start-spring-boot.html 1. Add dependencies note: Version0.2.x.RELEASECorresponding to Spring Boot 2.x version, version0.1.x.RELEASECorresponding to Spring Boot 1....

Nacos realizes dynamic configuration

Add configuration class: @AutoService(LauncherService.class) @Slf4j public class LauncherServiceImpl implements LauncherService {     @Override     public void launcher(SpringAppli...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top