dubbo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [dubbo] kylixs commented on issue #8213: Dubbo 3.0.0中使用xml配置无效,只有在properties中配置才有效
Date Tue, 06 Jul 2021 15:35:39 GMT

kylixs commented on issue #8213:
URL: https://github.com/apache/dubbo/issues/8213#issuecomment-874865645


   已查明此问题是由于Java11之后缺少javax.annotation-api导致`@PostConstruct`注解没有生效,导致dubbo
xml配置的bean没有加入到`ConfigManager`中。
   // AbstractConfig.java 中的addIntoConfigManager() 方法没有被执行
   ```java
       @PostConstruct
       public void addIntoConfigManager() {
           ApplicationModel.getConfigManager().addConfig(this);
       }
   ```
   
   解决办法:将下面的配置添加到pom.xml中,如果用Java11之后的版本则自动添加javax.annotation-api。
   ```
       <profiles>
           <!-- For jdk 11 above JavaEE annotation -->
           <profile>
               <id>javax.annotation</id>
               <activation>
                   <jdk>[1.11,)</jdk>
               </activation>
               <dependencies>
                   <dependency>
                       <groupId>javax.annotation</groupId>
                       <artifactId>javax.annotation-api</artifactId>
                       <version>1.3.2</version>
                   </dependency>
               </dependencies>
           </profile>
       </profiles>
   ```
   
   后续版本将修改配置初始化过程,计划移除AbstractConfig.addIntoConfigManager(),不再依赖`@PostConstruct`注解,到时则不需要强制依赖`javax.annotation-api`。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Mime
View raw message