9.1. 依赖引入 Nacos Discovery Starter
 修改 common中的pom.xml 文件。
<dependency> 
<groupId>com.alibaba.cloud</groupId> 
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency> 
9.2.使用 @EnableDiscoveryClient 注解开启服务注册与发现功能

@SpringBootApplication
@MapperScan("com.yxj.gulimall.coupon.dao") 
@EnableDiscoveryClient 
public class GulimallCouponApplication { 
public static void main(String[] args) 
    { 
          SpringApplication.run(GulimallCouponApplication.class, args); 
     }  
}

9.3.在应用的common中的application.yml 配置文件中配置 Nacos Server 地址和微服务名称
spring:
  application:
    name: gulimall-coupon
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://192.168.100.106:3306/gulimall_sms?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: root
  cloud:
    nacos:
      discovery:
        server-addr: 192.168.100.106:8848