@chickenlj   I investigate the issue in jdk11 ,  It's becase of 
`@PostConstruct` (`javax.annotation.PostConstruct`)

in [I can't use @PostConstruct and @PostDestroy with Java 
11](https://stackoverflow.com/questions/52701459/i-cant-use-postconstruct-and-postdestroy-with-java-11)

> Note that both @PostConstruct and @PreDestroy annotations are part of Java 
> EE. And since Java EE has been deprecated in Java 9 and removed in Java 11 we 
> have to add an additional dependency to use these annotations:

however , application name inject by 
```
@Parameter(key = APPLICATION_KEY, required = true, useKeyAsProperty = false)
    public String getName() {
        return name;
    }
```

and in 
[AbstractConfig.java](https://github.com/apache/dubbo/blob/d55f062fe77ea0f6a4c913d2418113297ff8403d/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java#L577)
```
    @PostConstruct
    public void addIntoConfigManager() {
        ApplicationModel.getConfigManager().addConfig(this);
    }
```
this method won't be invoked , so It's will throw
> No application config found or it's not a valid config! Please add 
> <dubbo:application name="..." /> to your spring config.

[ConfigValidationUtils 
.java](https://github.com/apache/dubbo/blob/53dca537089441e84160391c8f7efd7b40dd9155/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ConfigValidationUtils.java#L371)
```
  if (!config.isValid()) {
            throw new IllegalStateException("No application config found or 
it's not a valid config! " +
                    "Please add <dubbo:application name=\"...\" /> to your 
spring config.");
        }
```


I try to add dependency to my project
```
<dependency>
         <groupId>javax.annotation</groupId>
         <artifactId>javax.annotation-api</artifactId>
         <version>1.3.2</version>
</dependency>
```

it works .

So... do you have some advice to resolve it ?




[ Full content available at: https://github.com/apache/dubbo/issues/5793 ]
This message was relayed via gitbox.apache.org for 
[email protected]

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

Reply via email to