SpringCloudAlibaba + Nacos整合完成

This commit is contained in:
2023-08-16 11:08:26 +08:00
parent e9ca234f24
commit f022d1a9a4
24 changed files with 264 additions and 10 deletions

View File

@@ -19,6 +19,10 @@
</properties>
<dependencies>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>

View File

@@ -23,6 +23,7 @@ public class BookController {
@RequestMapping("/book/{bid}")
Book findBookById(@PathVariable("bid") int bid) {
System.out.println("调用图书服务");
return service.getBookById(bid);
}
}

View File

@@ -6,3 +6,11 @@ spring:
url: jdbc:mysql://43.143.164.194:3306/mac
username: mac
password: mactest
# 应用名称 bookservice
application:
name: bookservice
cloud:
nacos:
discovery:
# 配置Nacos注册中心地址
server-addr: localhost:8848