宋子宪博客

Spring Cloud Alibaba整合Nacos注册中心

添加pom依赖

<!-- Spring Cloud Alibaba Nacos-->
<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>

yml配置文件

spring:
  application:
    name: business-songzixian
  cloud:
    nacos:
      discovery:
        server-addr: http://localhost:8848

启动类添加@EnableDiscoveryClient注解

@EnableDiscoveryClient
@SpringBootApplication
public class XXXApplication {

    public static void main(String[] args) {
        SpringApplication.run(Oauth2BusinessApplication.class,args);
    }

}

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »