PHP中文网2017-04-18 10:46:12
@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.
PHPz2017-04-18 10:46:12
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
黄舟2017-04-18 10:46:12
<dubbo:reference interface="com.BService" id="bService"></dubbo:reference>
<dubbo:service interface="com.AService" ref="aService"></dubbo:service>
Should the human ref in AService point to bService?
阿神2017-04-18 10:46:12
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.
PHPz2017-04-18 10:46:12
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.
阿神2017-04-18 10:46:12
Configure consumer check on the consumer side. When starting, it does not check whether the producer is started.
<dubbo:consumer check="false" />