diff --git a/api-passenger/pom.xml b/api-passenger/pom.xml index 1fa622f..7e59b0d 100644 --- a/api-passenger/pom.xml +++ b/api-passenger/pom.xml @@ -17,6 +17,14 @@ org.springframework.boot spring-boot-starter-web + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + 2021.1 + + \ No newline at end of file diff --git a/api-passenger/src/main/java/com/mashibing/apipassenger/ApiPassengerApplication.java b/api-passenger/src/main/java/com/mashibing/apipassenger/ApiPassengerApplication.java index 382d7b5..06ff16e 100644 --- a/api-passenger/src/main/java/com/mashibing/apipassenger/ApiPassengerApplication.java +++ b/api-passenger/src/main/java/com/mashibing/apipassenger/ApiPassengerApplication.java @@ -2,8 +2,10 @@ package com.mashibing.apipassenger; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @SpringBootApplication +@EnableDiscoveryClient public class ApiPassengerApplication { public static void main(String[] args) { diff --git a/api-passenger/src/main/resources/application.yml b/api-passenger/src/main/resources/application.yml index 54b155f..bb8fa7f 100644 --- a/api-passenger/src/main/resources/application.yml +++ b/api-passenger/src/main/resources/application.yml @@ -1,2 +1,11 @@ server: - port: 8081 \ No newline at end of file + port: 8081 + +# nacos 服务发现 +spring: + application: + name: api-passenger + cloud: + nacos: + discovery: + server-addr: 127.0.0.1:8848 \ No newline at end of file