1.在springcloud_parent 父项目中创建新module项目:nacosclient 项目
2.修改pom.xml
<modelVersion>4.0.0</modelVersion>
<artifactId>springcloud_nacosclient</artifactId>
<parent>
<artifactId>springcloud_parent</artifactId>
<groupId>com.example</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--引入nacos-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
</dependencies>
3.application.properties修改配置
server.port=8989
#推荐大写
spring.application.name=NACOSCLIENT
#nacos server 地址
spring.cloud.nacos.server-addr=localhost:8848
|