Unexpected dataId when loading Pandora Boot startup configurations

更新时间:
复制 MD 格式

If your Pandora Boot application loads the wrong dataId from the configuration center, project.name is overwriting application.name at startup.

Symptom

The dataId obtained from the configuration center does not match the value you defined in spring.application.name. For example, the configuration center shows project-name.properties instead of the expected application-name.properties.

Cause

Pandora Boot versions provided by Alibaba Group include a ProjectInfoInitializer that replaces application.name with project.name during startup. This causes the dataId prefix to change, and your application loads the wrong configuration.

Note: This issue only affects Pandora Boot versions provided by Alibaba Group. Community or open-source Spring Boot versions do not include ProjectInfoInitializer.

Solution

Add the following JVM parameter to prevent ProjectInfoInitializer from overwriting application.name:

-DskipProjectInfoInitializer=true

For example, to start your application from the command line:

java -DskipProjectInfoInitializer=true -jar <your-application>.jar

Replace <your-application> with the file name of your JAR.

Verify the fix

After you restart the application with the parameter, confirm that the dataId matches the value in spring.application.name. If the correct configuration loads, the fix is working.