consumer獨(dú)立啟動(dòng)報(bào)錯(cuò)
Error creating bean with name 'userController': Injection of @Reference dependencies is failed;
nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.fk.mgmg.rpc.user.UserInfoRpc.
No provider available for the service com.fk.mgmg.rpc.user.UserInfoRpc:1.0.0 from the url
是consumer在啟動(dòng)的時(shí)候,會(huì)檢查@Reference依賴的Provider 服務(wù)是否有實(shí)例供汛。但是其實(shí)我們往往不想去檢查Provider是否啟動(dòng)澎羞。有如下兩種方式可以解決:
- 一: 在@Refrece中指定不檢查[check = false]
@Reference(protocol = "dubbo", version = "1.0.0", validation = "true", check = false)
- 二: 一個(gè)一個(gè)的去指定有時(shí)候太麻煩藕筋,我們想要全局設(shè)置,可以配置
dubbo.consumer.check = false
dubbo:
consumer:
check: false
這樣設(shè)置之后燥狰,全局生效