将子系统 service_obj 和 service_cmn 注册到 Nacos 中。
二 步骤 1 在 service 模块pom文件引入依赖2 在 service_obj 和 service_cmn 的配置文件添加 nacos 服务地址com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery
# nacos 服务地址 spring.cloud.nacos.discovery.server-addr=127.0.0.1:88483 在 service_obj 和 service_cmn 的启动类添加注解
@SpringBootApplication
@ComponentScan(basePackages = "com.baiyee")
@EnableDiscoveryClient
public class ServiceApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceApplication.class, args);
}
}
@SpringBootApplication
@ComponentScan(basePackages = {"com.baiyee"})
@EnableDiscoveryClient
public class ServiceCmnApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceCmnApplication.class, args);
}
}
4 启动 service_obj 和 service_cmn
三 到 nacos 管理界面观察服务是否注册上



