You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/05/20 04:46:27 UTC

[GitHub] [shardingsphere] Suny95 opened a new issue #10396: 分表算法类中无法调用spring bean?

Suny95 opened a new issue #10396:
URL: https://github.com/apache/shardingsphere/issues/10396


   分表算法类中调用静态方法获取分表索引序号失败
   ![image](https://user-images.githubusercontent.com/26239751/118920182-77a56f00-b968-11eb-81fb-bc16d8063b0a.png)
   
   ![image](https://user-images.githubusercontent.com/26239751/118920256-a3c0f000-b968-11eb-9667-18bdfe532dca.png)
   
   图中的OrderClient类是Spring Bean,TABLE_COUNT静态字段是在该Bean初始化时赋值
   
   问题1:
   + 目前的问题是在算法类中使用类OrderClient的静态方法getTableIndex无法正确获取到TABLE_COUNT修改后的值,只能获取到初始值,但在我们项目的业务代码中使用OrderClient的静态方法getTableIndex是可以拿到修改后的值的
   
   问题2:
   + 算法类中使用SpringContextHolder类获取Spring Bean也失败,因为ApplicationContext没有赋值到该类中导致,但在我们项目的业务代码中也是可以正常使用的
   ![image](https://user-images.githubusercontent.com/26239751/118920628-58f3a800-b969-11eb-96a8-42ba45c32d5b.png)
   
   


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

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



[GitHub] [shardingsphere] strongduanmu closed issue #10396: 分表算法类中无法调用spring bean?

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #10396:
URL: https://github.com/apache/shardingsphere/issues/10396


   


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

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



[GitHub] [shardingsphere] strongduanmu commented on issue #10396: 分表算法类中无法调用spring bean?

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #10396:
URL: https://github.com/apache/shardingsphere/issues/10396#issuecomment-844714460


   @Suny95 For English only, other language will not be accepted.


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

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