injvm and local call
injvm protocol doesn't work well with scope.
injvm should not be registered to register center
<dubbo:protocol name="injvm"/>
<bean id="target" class="org.apache.dubbo.samples.provider.GreetingsServiceImpl"/>
<dubbo:service interface="org.apache.dubbo.samples.api.GreetingsService" ref="target" protocol="injvm"/>
injvm url is registered
local call doesn't work when protocol is injvm
The following configuration is supposed to work but dubbo complains no provider found from registry center.
<dubbo:protocol name="injvm"/>
<bean id="target" class="org.apache.dubbo.samples.provider.GreetingsServiceImpl"/>
<dubbo:service interface="org.apache.dubbo.samples.api.GreetingsService" ref="target" scope="local" protocol="injvm"/>
<dubbo:reference id="demoService" interface="org.apache.dubbo.samples.api.GreetingsService" scope="local"/>
I try to reproduce the problem with your config, but it fails.
I reproduced your problem and made changes to the injvm export.Will submit a pr fix this bug in the near future
I am not sure what is the best way to fix this issue.
In a real scene, I think we will use :
@Autowired
private GreetingsService target;
// remove this configuration
//<dubbo:reference id="demoService" interface="org.apache.dubbo.samples.api.GreetingsService" //scope="local"/>
instead of:
@Autowired
private GreetingsService demoService;
<dubbo:reference id="demoService" interface="org.apache.dubbo.samples.api.GreetingsService" scope="local"/>
This modification increase some complex logic and I suggest we donot fix this issue.
I merged #3857 since it does solve the two problems I reported. Later we can consider removing 'injvm' and 'scope' from user's configuration entirely.