集成 nacos注册中心配置使用

pom

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <shiro.version>1.7.1</shiro.version><!-- fhadmin.cn -->
        <spring-cloud.version>2020.0.3</spring-cloud.version>
        <spring-cloud-Alibaba.version>2021.1</spring-cloud-Alibaba.version>
        <maven-jar-plugin.version>3.0.0</maven-jar-plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>${spring-cloud-Alibaba.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>        
        </dependencies>
    </dependencyManagement>

<dependencies>
         <!-- nacos注册中心 -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId><!-- fhadmin.cn -->
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
        </dependency>
</dependencies>

application.properties

#nacos指向注册中心 fhadmin.cn
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
#nacos访问地址的用户名
spring.cloud.nacos.discovery.username=nacos
#nacos访问地址的密码
spring.cloud.nacos.discovery.password=nacos
本作品采用《CC 协议》,转载必须注明作者和本文链接
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!