zhangzhiyu112233 commented on issue #16083:
URL: https://github.com/apache/dubbo/issues/16083#issuecomment-3903092962

   When Dubbo is used in conjunction with the Spring container, if the Dubbo 
generic invocation mode is used and the bean is created using the @Bean 
annotation, it can result in the consumer not being registered as a Spring bean.
   
   For example, when registering a consumer using Dubbo's generic invocation 
mode, if the @Bean annotation is used to create this bean, it can result in the 
consumer not being registered as a Spring bean.
   
   The `reference.get()` method returns a proxy object, and the `tClass` of 
this proxy object is `'com.xxx.XxxService'`.
   
   <img width="1586" height="730" alt="Image" 
src="https://github.com/user-attachments/assets/93a66446-55c5-436b-b893-601cf993cf95";
 />
   
   The reference.get() method returns a proxy object, and the tClass of this 
proxy object is 'com.xxx.XxxService'. Additionally, this bean is injected using 
@Autowired and @Qualifier as follows:
   @Autowired
   @Qualifier("XxxService")
   private GenericService xxxService;
   
   The code for generating a proxy object by Dubbo is as follows: If 
com.xxx.XxxService exists in the current code package, but 
reference.setGeneric(true); is still set, it will cause the actual object of 
the proxy to be com.xxx.XxxService instead of 
org.apache.dubbo.rpc.service.GenericService.
   
   <img width="2244" height="1556" alt="Image" 
src="https://github.com/user-attachments/assets/453ea8aa-e6fc-4900-92e5-2784502689bb";
 />
   
   spring start error text e.g :
   
   Unsatisfied dependency expressed through field 
'membershipUserTagTestService'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'membershipUserTagTestServiceImpl': Unsatisfied 
dependency expressed through field 'aeMarketingStrategyShowFacadeGeneric'; 
nested exception is 
org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 
'aeMarketingStrategyShowFacadeGeneric' is expected to be of type 
'org.apache.dubbo.rpc.service.GenericService' but was actually of type 
'com.sun.proxy.$Proxy524'


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to