一、基于Nacos的服务提供者
服务提供方 (Service Provider)
是指提供可复用和可调用服务的应用方
- 在父工程下新建module (cloudalibaba-provider-payment-9001)
- POM 引入
<!--SpringCloud ailibaba nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
- YML
server:
port: 9001
spring:
application:
name: nacos-payment-provider
cloud:
nacos:
discovery:
server-addr: 172.28.129.83:8848 #配置Nacos地址
management:
endpoints:
web:
exposure:
include: '*'
- 主启动
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class