YvCeung opened a new issue, #7582: URL: https://github.com/apache/incubator-seata/issues/7582
### Check Ahead - [x] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate. - [x] I am willing to try to fix this bug myself. ### Ⅰ. Issue Description **Description:** When using a YAML configuration file in Seata, if a configuration item is an integer, Seata fails to read the value correctly. This issue manifests in two main scenarios: --- **1. Application startup failure due to missing configuration values** During project startup, the `SessionHolder` initialization logic triggers the database connection pool initialization. If the configuration file is in YAML format **and** the database password is an integer, Seata fails to read the value, causing the application to fail to start. **Example YAML configuration:** ```yaml store: db: maxConn: 30 vgroupTable: vgroup-table datasource: druid minConn: 5 globalTable: global_table lockTable: lock_table driverClassName: com.mysql.cj.jdbc.Driver user: root branchTable: branch_table distributedLockTable: distributed_lock password: 123456 queryLimit: 100 dbType: h2 url: jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true maxWait: 5000 publicKey: "" mode: db session: mode: db ``` When the password is an integer (e.g., `123456`), `getConfig` returns `null` and the password is not passed to the connection pool, leading to a connection error: The configuration of code breakpoint reading is as follows: <img width="2030" height="1116" alt="Image" src="https://github.com/user-attachments/assets/a91b9f3e-5a23-47f7-9c8a-b426300997fc" /> **However**, when the password is quoted as a string, it works normally: ```yaml password: "aaaaaa" ``` the data acquisition is normal: <img width="2036" height="862" alt="Image" src="https://github.com/user-attachments/assets/dc632a19-9131-485d-9eb5-756208fc6a6d" /> --- **2. Configuration change listener fails to read integer values from YAML** In Seata, when listening for configuration changes (e.g., from Nacos), if a changed configuration item is an integer, `getProperty` fails to retrieve the value and instead returns the default value. The root cause is in the **YAML parsing logic** (`ProcessorYml`). If the YAML configuration item is an integer, it will be stored in the underlying `Properties` object as a non-`String` type. When code later calls `getProperty(...)`, it returns `null` because `Properties.getProperty` only works with `String` values. This means: * For **any integer-type configuration item** in YAML format * Retrieved via **`getProperty`** (which is the common approach for config center integrations like Nacos, Etcd, etc.) * The final value will always be `null` (or fall back to the default value) --- **Unit test evidence:** ```java public class ProcessorYamlTest { @Test void testProcessor_NormalYaml() { String yamlConfig = "server:\n" + " port: 8080\n" + " host: localhost\n" + "spring:\n" + " datasource:\n" + " url: jdbc:mysql://localhost:3306/test\n" + " username: root"; ProcessorYaml processorYaml = new ProcessorYaml(); Properties props = processorYaml.processor(yamlConfig); assertEquals(8080, props.get("server.port")); assertEquals("", props.getProperty("server.port", "")); // fails, returns default assertEquals("localhost", props.getProperty("server.host")); assertEquals("jdbc:mysql://localhost:3306/test", props.getProperty("spring.datasource.url")); assertEquals("root", props.getProperty("spring.datasource.username")); } } ``` **Test result:** * `props.get("server.port")` → `8080` (integer) ✅ * `props.getProperty("server.port", "")` → `""` (empty string, default value) ❌ --- In addition, I also compared the situation where the configuration file format is properties. I found that whether it is an integer or a String, the properties format file parses to a string. Therefore, the fundamental parsing logic of the two is also different. eg: <img width="2048" height="1132" alt="Image" src="https://github.com/user-attachments/assets/a34bd9e5-8ecd-4584-b252-2ca53565bfb7" /> ### Ⅱ. Describe what happened _No response_ ### Ⅲ. Describe what you expected to happen _No response_ ### Ⅳ. How to reproduce it (as minimally and precisely as possible) _No response_ ### Ⅴ. Anything else we need to know? _No response_ ### Ⅵ. Environment _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org