SEATA 1.0.0使用yaml配置替换file.conf 和 registry.conf

本文介绍了如何在SEATA 1.0.0中使用YAML配置替代原有的file.conf和registry.conf。通过两步完成迁移:更新依赖以解决报错问题,并在YAML配置文件中设置相应属性。提供了详细演示示例链接。

Client Configure for SEATA 1.0.0

在SEATA 1.0.0 中发布了一个新的feature,可以使用yaml/properties来替换掉我们在之前引入的file.confregistry.conf. 只需2步即可达到目的:

  • 第一步,更改依赖
  <!--seata-->
          <dependency>
              <groupId>io.seata</groupId>
              <artifactId>seata-spring-boot-starter</artifactId>
              <version>1.0.0</version>
              <exclusions>
                  <exclusion>
                      <artifactId>seata-all</artifactId>
                      <groupId>io.seata</groupId>
                  </exclusion>
              </exclusions>
          </dependency>
          <dependency>
              <groupId>io.seata</groupId>
              <artifactId>seata-all</artifactId>
              <version>1.0.0</version>
          </dependency>
### Seata 1.5.2 中 `registry.conf` `file.conf` 文件的位置及配置 #### 文件位置变更说明 在Seata 1.5.2版本中,原有的`conf/registry.conf`配置文件已被移除,不再作为默认配置文件存在[^1]。取而代之的是可以直接通过修改`application.yml`来进行相应的配置调整。 然而,在某些场景下仍然可能需要使用传统的`registry.conf``file.conf`来完成特定功能的设置。对于这些情况: - **`registry.conf`**: 此文件通常用于定义服务注册中心的相关参数。虽然官方推荐使用新的配置方式,但在实际项目迁移过程中可能会保留此文件以便兼容旧版应用逻辑。 - **`file.conf`**: 主要负责存储与事务协调器(TC)有关的信息以及一些基础属性设定。 如果确实需要创建这两个文件,则可以根据需求手动建立于项目的资源路径下(如`src/main/resources/seata/conf/`),并按照如下模板编写内容。 #### 配置示例 ##### Registry Configuration (`registry.conf`) ```properties registry { type = "nacos" nacos { application = "seata-server" serverAddr = "localhost:8848" group = "SEATA_GROUP" namespace = "" cluster = "default" } } ``` ##### File Configuration (`file.conf`) ```properties store { mode = "db" db { datasource = "druid" dbType = "mysql" driverClassName = "com.mysql.cj.jdbc.Driver" url = "jdbc:mysql://localhost:3306/seata?useSSL=false&characterEncoding=utf8&serverTimezone=UTC" user = "root" password = "password" } } service { vgroupMapping.my_test_tx_group = "default" default.grouplist = "127.0.0.1:8091" enableDegrade = false disableGlobalTransaction = false } ``` 上述配置展示了如何针对Nacos注册中心服务端数据库连接进行基本设置。需要注意的是,具体环境下的URL、用户名密码等敏感信息应当依据实际情况作出相应更改。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值