@Autowired has a required attribute, which can be configured as false. In this case, if the corresponding bean is not found, an exception will not be thrown.
Is it possible that the @Service annotation introduces an error? What should be used here is Spring's @Service (org.springframework.stereotype.Servic). If dubbo's @Service is used, it cannot be injected.
The reason for the error is that the target provided class cannot be found. By default, dubbo will check whether the provided class exists. If it does not exist, an error will be reported directly
Option 1: Do not check the configuration reference<dubbo:reference check="false" interface="com.BService" id="bService"></dubbo:reference>, so that no error will be reported when starting, and it will not affect use.
Option 2: 1. First comment out dubbo:reference of S1 or S2 (assuming it is S1); 2. Start S1, then the AService service will be provided, and S2 can start normally; 3. Cancel Notes for S1, restart.
@Autowired has a required attribute, which can be configured as false. In this case, if the corresponding bean is not found, an exception will not be thrown.
Post the error message and take a look. There are many reasons why the injection cannot be done. Depends on the error message for details
Should the human ref in AService point to bService?
Is it possible that the @Service annotation introduces an error? What should be used here is Spring's @Service (org.springframework.stereotype.Servic). If dubbo's @Service is used, it cannot be injected.
The reason for the error is that the target provided class cannot be found. By default, dubbo will check whether the provided class exists. If it does not exist, an error will be reported directly
Option 1: Do not check the configuration reference
<dubbo:reference check="false" interface="com.BService" id="bService"></dubbo:reference>
, so that no error will be reported when starting, and it will not affect use.Option 2:
1. First comment out
dubbo:reference
of S1 or S2 (assuming it is S1);2. Start S1, then the AService service will be provided, and S2 can start normally;
3. Cancel Notes for S1, restart.
Configure consumer check on the consumer side. When starting, it does not check whether the producer is started.
You can refer to this video content: http://www.roncoo.com/course/...