WangzJi commented on code in PR #7705:
URL: https://github.com/apache/incubator-seata/pull/7705#discussion_r2444229076


##########
seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/org/apache/seata/spring/boot/autoconfigure/loader/SeataPropertiesLoader.java:
##########
@@ -60,10 +60,7 @@ public class SeataPropertiesLoader implements 
ApplicationContextInitializer<Conf
     @Override
     public void initialize(ConfigurableApplicationContext applicationContext) {
         ConfigurableEnvironment environment = 
applicationContext.getEnvironment();
-        if 
(ObjectHolder.INSTANCE.getObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT) == 
null) {
-            ObjectHolder.INSTANCE.setObject(
-                    OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT, 
applicationContext.getEnvironment());
-        }
+        
ObjectHolder.INSTANCE.setObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT, 
environment);

Review Comment:
   In Spring Cloud, it's the same Environment instance throughout, but its 
PropertySources content evolves over time.
     Timeline:
     1. SeataClientEnvironmentPostProcessor runs (Order: HIGHEST_PRECEDENCE)
        - Sets environment in ObjectHolder
        - At this point: PropertySources = [bootstrap, system]
        - application.yml NOT loaded yet
   
     2. ConfigDataEnvironmentPostProcessor runs (Order: HIGHEST_PRECEDENCE + 10)
        - Loads application.yml into the same Environment instance
        - Now: PropertySources = [application, bootstrap, system]



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to