zhuangjinjin opened a new issue #9207:
URL: https://github.com/apache/dubbo/issues/9207


   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 2.7.14
   * Operating System version: Mac OS 11.5.2
   * Java version: jdk1.8.0_261
   
   ### Steps to reproduce this issue
   
   I want to get spring environment properties via ConfigurationUtils
   
   In my demo, Application.java
   `
   @SpringBootApplication
   public class Application {
   
       @Bean
       public ApplicationRunner applicationRunner() {
           return (args) ->
               Assert.notNull(ConfigurationUtils.getProperty("server.name"), 
"serverName must not be null");
       }
   
       public static void main(String[] args) {
           SpringApplication.run(Application.class, args);
       }
   `
   application.yml
   `
   server:
     name: dubbo-demo
     port: 0
   
   dubbo:
     application:
       name: dubbo-demo
     config-center:
       include-spring-env: true
   `
   
   ### Expected Behavior
   I hope the above assertion will pass
   
   ### Actual Behavior
   It does't work in my way
   
   ```
   java.lang.IllegalStateException: Failed to execute ApplicationRunner
        at 
org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:789)
 [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
        at 
org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:776)
 [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:322) 
[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) 
[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) 
[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
        at org.example.Application.main(Application.java:24) [classes/:na]
   Caused by: java.lang.IllegalArgumentException: serverName must not be null
        at org.apache.dubbo.common.utils.Assert.notNull(Assert.java:27) 
~[dubbo-2.7.14.jar:2.7.14]
        at 
org.example.Application.lambda$applicationRunner$0(Application.java:20) 
[classes/:na]
        at 
org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:786)
 [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
        ... 5 common frames omitted
   ```
   


-- 
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