You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/03/22 07:51:48 UTC

[GitHub] [servicecomb-java-chassis] sunshinexp1 opened a new issue #2740: @RpcReference注解在某些场景会失效

sunshinexp1 opened a new issue #2740:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2740


   针对这个@RpcReference失效的bean进行debug定位,发现初始化,执行到applyBeanPostProcessorsBeforeInitialization时,对应的RpcReferenceProcessor还没有被registerBeanPostProcessors注册上,能否提高一点RpcReferenceProcessor注册的优先级,比如实现PriorityOrdered接口,确保RpcReferenceProcessor更早一点注册,避免时序问题导致部分@RpcReference失效。


-- 
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: commits-unsubscribe@servicecomb.apache.org

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



[GitHub] [servicecomb-java-chassis] sunshinexp1 commented on issue #2740: @RpcReference注解在某些场景会失效

Posted by GitBox <gi...@apache.org>.
sunshinexp1 commented on issue #2740:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2740#issuecomment-1075982029


   > 能提供下具体的写法代码吗?
   
   Demo代码已经提供,可以看看是否有问题。


-- 
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: commits-unsubscribe@servicecomb.apache.org

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



[GitHub] [servicecomb-java-chassis] sunshinexp1 commented on issue #2740: @RpcReference注解在某些场景会失效

Posted by GitBox <gi...@apache.org>.
sunshinexp1 commented on issue #2740:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2740#issuecomment-1075978381


   我提供一个Demo吧,三个类:
   接口类:
   `public interface DemoInterface {
       void test();
   }
   `
   接口实现类:
   `@Service
   public class DemoInterfaceImpl implements DemoInterface {
       @RpcReference(microserviceName = "DemoService", schemaId = "demo-api")
       private IDemoService demoService;
       
       @Override
       public void test() {
           System.out.println("test");
       }
   }`
   
   DemoBean类实现FactoryBean,并且通过构造函数注入上述的DemoInterfaceImpl 
   `@Service
   public class DemoBean implements FactoryBean<String> {
       @Setter
       private DemoInterface demoInterface;
       
       @Autowired
       public DemoBean(DemoInterface demoInterface) {
           this.demoInterface = demoInterface;
       }
       
       @Override
       public String getObject() {
           return "demoBean";
       }
   
       @Override
       public Class<?> getObjectType() {
           return String.class;
       }
   
       @Override
       public boolean isSingleton() {
           return true;
       }
   }`
   
   最后出现的问题就是接口实现类DemoInterfaceImpl里的@RpcReference注解不生效
   
   
   
   


-- 
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: commits-unsubscribe@servicecomb.apache.org

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



[GitHub] [servicecomb-java-chassis] sunshinexp1 edited a comment on issue #2740: @RpcReference注解在某些场景会失效

Posted by GitBox <gi...@apache.org>.
sunshinexp1 edited a comment on issue #2740:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2740#issuecomment-1075978381


   我提供一个Demo吧,三个类:
   接口类:
   
   ```
   public interface DemoInterface {
       void test();
   }
   ```
   
   接口实现类:
   
   ```
   @Service
   public class DemoInterfaceImpl implements DemoInterface {
       @RpcReference(microserviceName = "DemoService", schemaId = "demo-api")
       private IDemoService demoService;
       
       @Override
       public void test() {
           System.out.println("test");
       }
   }
   ```
   
   DemoBean类实现FactoryBean,并且通过构造函数注入上述的DemoInterfaceImpl 
   
   ```
   @Service
   public class DemoBean implements FactoryBean<String> {
       @Setter
       private DemoInterface demoInterface;
       
       @Autowired
       public DemoBean(DemoInterface demoInterface) {
           this.demoInterface = demoInterface;
       }
       
       @Override
       public String getObject() {
           return "demoBean";
       }
   
       @Override
       public Class<?> getObjectType() {
           return String.class;
       }
   
       @Override
       public boolean isSingleton() {
           return true;
       }
   }
   ```
   
   最后出现的问题就是接口实现类DemoInterfaceImpl里的@RpcReference注解不生效
   
   
   
   


-- 
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: commits-unsubscribe@servicecomb.apache.org

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



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2740: @RpcReference注解在某些场景会失效

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2740:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2740#issuecomment-1075122952


   能提供下具体的写法代码吗?


-- 
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: commits-unsubscribe@servicecomb.apache.org

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