16-Nacos-快速入门
说是快速入门,实际就是服务注册[服务发现与eureka是一样的,不用修改代码]
- 添加依赖
- 修改配置
父工程:
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.2.5.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
子工程:
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
<!-- </dependency>-->
spring:
datasource:
url: jdbc:mysql://47.108.52.160:3306/cloud_order?useSSL=false
username: root
password: Mysql12345^
driver-class-name: com.mysql.jdbc.Driver
application:
name: orderservice
cloud:
nacos:
discovery:
server-addr: localhost:8848
#eureka:
# client:
# service-url:
# defaultZone: http://localhost:10086/eureka/