# 添加依賴
```xml
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
```
完整版
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>cloudframe</artifactId>
<groupId>com.gosuncn</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>authorize</artifactId>
<dependencies>
<dependency>
<groupId>com.gosuncn</groupId>
<artifactId>common</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>com/gosuncn/dao/*.xml</include>
</includes>
</resource>
</resources>
</build>
</project>
```
# 修改配置文件
```yaml
server:
port: 8001
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql:///sys_rbac?serverTimezone=UTC
username: root
password: root
application:
name: authorize
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
mybatis:
mapper-locations: classpath*:/com/gosuncn/dao/*.xml
cloudframe:
private-key: cigc.jks
key-password: cigcjks
alias: cigcjks
```
# 修改主啟動類
```java
package com.gosuncn;
@EnableDiscoveryClient // 注冊到nacos
@SpringBootApplication
public class AuthorizeApplication {
public static void main(String[] args) {
SpringApplication.run(AuthorizeApplication.class, args);
}
}
```