You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Huangxuny1 (GitHub)" <gi...@apache.org> on 2020/03/19 02:12:09 UTC
[GitHub] [dubbo] Huangxuny1 commented on issue #5793: jdk11,
No application config found or it's not a valid config!
@chickenlj I investigate the issue in jdk11 , It's becase of `@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.
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 notifications@dubbo.apache.org