已打开 02:17PM - 24 Jul 26 UTC
已关闭 07:51AM - 28 Jul 26 UTC
### Check Ahead
- [x] I have searched the [issues](https://github.com/seata/sea…ta/issues) of this repository and believe that this is not a duplicate.
- [ ] I am willing to try to fix this bug myself.
### Ⅰ. Issue Description
When configuring `seata.registry.preferred-networks` or `seata.registry.ignored-interfaces` in `application.yml`, the configuration does not take effect. Only the corresponding environment variables (`REGISTRY_PREFERREDNETWORKS` and `REGISTRY_IGNOREDINTERFACES`) work.
### Ⅱ. Describe what happened
1. Configured `seata.registry.preferred-networks: 172.30.31.*` in `application.yml`, but the server still registered with the wrong IP address (e.g., `169.254.3.136`). The YAML configuration was completely ignored.
2. When using the environment variable `REGISTRY_PREFERREDNETWORKS=172.30.31.*`, the server correctly registered with the expected IP address (e.g., `172.30.31.3`).
3. Similarly, `seata.registry.ignored-interfaces=bridge.*` in `application.yml` does not take effect; only `REGISTRY_IGNOREDINTERFACES=en.*` via environment variable works.
### Ⅲ. Describe what you expected to happen
The YAML configuration `seata.registry.preferred-networks` and `seata.registry.ignored-interfaces` should take effect the same way as the environment variables `REGISTRY_PREFERREDNETWORKS` and `REGISTRY_IGNOREDINTERFACES`.
### Ⅳ. How to reproduce it (as minimally and precisely as possible)
### Prerequisites
1. A running Nacos server
2. Build the server module locally:
```shell
mvn -pl server install -am -DskipTests
```
### Steps
1. Configure `application.yml` with `seata.registry.preferred-networks`:
```yaml
seata:
config:
type: nacos
nacos:
server-addr: 127.0.0.1:8848
namespace:
username:
password:
registry:
type: nacos
preferred-networks: 172.30.31.*
nacos:
server-addr: 127.0.0.1:8848
namespace:
username:
password:
store:
mode: file
```
2. Add the Spring Boot Maven plugin profile in `server/pom.xml`:
```xml
<profile>
<id>release-seata-jar</id>
<properties>
<mysql.jdbc.version>5.1.42</mysql.jdbc.version>
<mysql8.jdbc.version>8.0.27</mysql8.jdbc.version>
<dependencies.copy.skip>false</dependencies.copy.skip>
</properties>
<build>
<finalName>seata-server</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot-for-server.version}</version>
<configuration>
<mainClass>org.apache.seata.server.ServerApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
```
3. Start the server (ensure the env var is NOT set):
```shell
unset REGISTRY_PREFERREDNETWORKS
mvn -pl server spring-boot:run -Prelease-seata-jar
```
<img width="2092" height="1230" alt="Image" src="https://github.com/user-attachments/assets/38f163ae-2778-4160-b328-988b51dba361" />
4. Observe the registered IP in Nacos — it is NOT `172.30.31.*` (the YAML config is ignored).
5. For comparison, start with the environment variable (this works correctly):
```shell
REGISTRY_PREFERREDNETWORKS=172.30.31.* mvn -pl server spring-boot:run -Prelease-seata-jar
```
<img width="2092" height="1230" alt="Image" src="https://github.com/user-attachments/assets/1c497376-1f4d-40b0-a364-badab65ee3e6" />
6. Observe the registered IP in Nacos — it correctly uses `172.30.31.3`.
### Reference
- The `application.example.yml` documents the `seata.registry.preferred-networks` configuration key.
### Ⅴ. Anything else we need to know?
The same issue applies to `seata.registry.ignored-interfaces` — it is ignored when set via YAML, but works via the `REGISTRY_IGNOREDINTERFACES` environment variable.
### Ⅵ. Environment
seata server version: 2.x