配置中心

路由:/managements/configuration 参考nacos:http://172.20.32.140:30002/nacos nacos/nacos

创建配置

字段 说明
*配置标识 必填,配置标识只允许字母数字以及_-.:
*配置分组 必填,长度200
标签 选填,长度200
归属应用 选填,长度200
配置格式 必填,默认“TEXT”, 可选“TEXT”, “JSON”, “XML”, “YAML”, “HTML”, “Properties”, “TOML”
配置内容
操作 “发布”“返回”
  • Text
datasource.url=jdbc:mysql://localhost:3306/userdb
datasource.username=root
datasource.password=root123
driver=com.mysql.cj.jdbc.Driver
log.level=debug
cache.enabled=true
  • Yaml
spring:
  datasource:
    url: jdbc:mysql://localhost:3306/userdb
    username: root
    password: root123
    driver-class-name: com.mysql.cj.jdbc.Driver

logging:
  level:
    com.example.user: debug
  • Json
{
  "spring": {
    "datasource": {
      "url": "jdbc:mysql://localhost:3306/userdb",
      "username": "root",
      "password": "root123",
      "driver-class-name": "com.mysql.cj.jdbc.Driver"
    }
  },
  "logging": {
    "level": {
      "com.example.user": "debug"
    }
  }
}
  • Xml
<configuration>
    <spring>
        <datasource>
            <url>jdbc:mysql://localhost:3306/userdb</url>
            <username>root</username>
            <password>root123</password>
            <driver-class-name>com.mysql.cj.jdbc.Driver</driver-class-name>
        </datasource>
    </spring>

    <logging>
        <level>
            <com.example.user>debug</com.example.user>
        </level>
    </logging>
</configuration>
  • Html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>User Service Config</title>
  <meta name="spring.datasource.url" content="jdbc:mysql://localhost:3306/userdb">
  <meta name="spring.datasource.username" content="root">
  <meta name="spring.datasource.password" content="root123">
  <meta name="spring.datasource.driver-class-name" content="com.mysql.cj.jdbc.Driver">
  <meta name="logging.level.com.example.user" content="debug">
</head>
<body>
  <div class="welcome">
    <h1>Hello, HTML!</h1>
  </div>
</body>
</html>
  • Properties
spring.datasource.url=jdbc:mysql://localhost:3306/userdb
spring.datasource.username=root
spring.datasource.password=root123
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

logging.level.com.example.user=debug

-Toml

[spring.datasource]
url = "jdbc:mysql://localhost:3306/userdb"
username = "root"
password = "root123"
driver-class-name = "com.mysql.cj.jdbc.Driver"

[logging.level]
"com.example.user" = "debug"

导入配置

可导入文件:nacos_config_export_20250826104752.zip