<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.3-SNAPSHOT</li>
<li>Operating System version: macOs</li>
<li>Java version: JDK 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>Assume Demo interface have sayHello and sayHi method.</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;dubbo:reference id=&quot;demoService&quot; interface=&quot;com.ctrip.Demo&quot; timeout=&quot;1000&quot;&gt;
  &lt;dubbo:method name=&quot;sayHello&quot;&gt;
    &lt;dubbo:parameter key=&quot;timeout&quot; value=&quot;800&quot;/&gt;
  &lt;/dubbo:method&gt;
&lt;/dubbo:reference&gt;"><pre class="notranslate"><code class="notranslate">&lt;dubbo:reference id="demoService" interface="com.ctrip.Demo" timeout="1000"&gt;
  &lt;dubbo:method name="sayHello"&gt;
    &lt;dubbo:parameter key="timeout" value="800"/&gt;
  &lt;/dubbo:method&gt;
&lt;/dubbo:reference&gt;
</code></pre></div>
<ol start="2" dir="auto">
<li>Make a sync call to sayHello, the timeout is 800 but not 1000. We have not get method timeout from the url.</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="asyncResult.get(getUrl().getParameter(TIMEOUT_KEY, DEFAULT_TIMEOUT), TimeUnit.MILLISECONDS);"><pre class="notranslate"><code class="notranslate">asyncResult.get(getUrl().getParameter(TIMEOUT_KEY, DEFAULT_TIMEOUT), TimeUnit.MILLISECONDS);
</code></pre></div>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">The timeout should be 1000 for sayHello.</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">The timeout is 800 for sayHello.</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Just put your stack trace here!"><pre class="notranslate"><code class="notranslate">Just put your stack trace here!
</code></pre></div>
<ul dir="auto">
<li>[√] I have searched the <a href="https://github.com/apache/incubator-dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li>[√] I have checked the <a href="https://github.com/apache/incubator-dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.5.7</li>
<li>Operating System version: win10</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Step to reproduce this issue</h3>
<p dir="auto">有A、B两个服务，相互依赖时会造成事务失效，简要代码如下：</p>
<blockquote>
<p dir="auto">AServiceImpl</p>
</blockquote>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@Service(interfaceClass=IAService.class,group=&quot;test&quot;,version=&quot;1.0.0&quot;)
@Transactional
public class AServiceImpl implements IAService {
    @Autowired
    private ITestService testService;

    @Autowired
    private IBService bService;
    @Override
    public void test(String string) {
        TestEntity testEntity = new TestEntity();
        testEntity.setTest(&quot;A-&quot;+string);
        testEntity = testService.save(testEntity);
        if(!Objects.isNull(testEntity.getId())){
            throw new RuntimeException(&quot;AService test....a...&quot;);
        }
    }
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">Service</span>(<span class="pl-s1">interfaceClass</span>=<span class="pl-smi">IAService</span>.<span class="pl-k">class</span>,<span class="pl-s1">group</span>=<span class="pl-s">"test"</span>,<span class="pl-s1">version</span>=<span class="pl-s">"1.0.0"</span>)
<span class="pl-c1">@</span><span class="pl-c1">Transactional</span>
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">AServiceImpl</span> <span class="pl-k">implements</span> <span class="pl-smi">IAService</span> {
    <span class="pl-c1">@</span><span class="pl-c1">Autowired</span>
    <span class="pl-k">private</span> <span class="pl-smi">ITestService</span> <span class="pl-s1">testService</span>;

    <span class="pl-c1">@</span><span class="pl-c1">Autowired</span>
    <span class="pl-k">private</span> <span class="pl-smi">IBService</span> <span class="pl-s1">bService</span>;
    <span class="pl-c1">@</span><span class="pl-c1">Override</span>
    <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">test</span>(<span class="pl-smi">String</span> <span class="pl-s1">string</span>) {
        <span class="pl-smi">TestEntity</span> <span class="pl-s1">testEntity</span> = <span class="pl-k">new</span> <span class="pl-smi">TestEntity</span>();
        <span class="pl-s1">testEntity</span>.<span class="pl-en">setTest</span>(<span class="pl-s">"A-"</span>+<span class="pl-s1">string</span>);
        <span class="pl-s1">testEntity</span> = <span class="pl-s1">testService</span>.<span class="pl-en">save</span>(<span class="pl-s1">testEntity</span>);
        <span class="pl-k">if</span>(!<span class="pl-smi">Objects</span>.<span class="pl-en">isNull</span>(<span class="pl-s1">testEntity</span>.<span class="pl-en">getId</span>())){
            <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-smi">RuntimeException</span>(<span class="pl-s">"AService test....a..."</span>);
        }
    }
}</pre></div>
<blockquote>
<p dir="auto">BServiceImpl</p>
</blockquote>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@Service(interfaceClass=IBService.class,group=&quot;test&quot;,version=&quot;1.0.0&quot;)
@Transactional
public class BServiceImpl implements IBService {
    @Autowired
    private ITestService testService;

    @Autowired
    private IAService aService;//相互引用，但实际并未使用
    @Override
    public void test(String string) {
        TestEntity testEntity = new TestEntity();
        testEntity.setTest(&quot;B-&quot;+string);
        testEntity = testService.save(testEntity);
        if(!Objects.isNull(testEntity.getId())){
            throw new RuntimeException(&quot;BService test...b....&quot;);
        }
    }
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">Service</span>(<span class="pl-s1">interfaceClass</span>=<span class="pl-smi">IBService</span>.<span class="pl-k">class</span>,<span class="pl-s1">group</span>=<span class="pl-s">"test"</span>,<span class="pl-s1">version</span>=<span class="pl-s">"1.0.0"</span>)
<span class="pl-c1">@</span><span class="pl-c1">Transactional</span>
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">BServiceImpl</span> <span class="pl-k">implements</span> <span class="pl-smi">IBService</span> {
    <span class="pl-c1">@</span><span class="pl-c1">Autowired</span>
    <span class="pl-k">private</span> <span class="pl-smi">ITestService</span> <span class="pl-s1">testService</span>;

    <span class="pl-c1">@</span><span class="pl-c1">Autowired</span>
    <span class="pl-k">private</span> <span class="pl-smi">IAService</span> <span class="pl-s1">aService</span>;<span class="pl-c">//相互引用，但实际并未使用</span>
    <span class="pl-c1">@</span><span class="pl-c1">Override</span>
    <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">test</span>(<span class="pl-smi">String</span> <span class="pl-s1">string</span>) {
        <span class="pl-smi">TestEntity</span> <span class="pl-s1">testEntity</span> = <span class="pl-k">new</span> <span class="pl-smi">TestEntity</span>();
        <span class="pl-s1">testEntity</span>.<span class="pl-en">setTest</span>(<span class="pl-s">"B-"</span>+<span class="pl-s1">string</span>);
        <span class="pl-s1">testEntity</span> = <span class="pl-s1">testService</span>.<span class="pl-en">save</span>(<span class="pl-s1">testEntity</span>);
        <span class="pl-k">if</span>(!<span class="pl-smi">Objects</span>.<span class="pl-en">isNull</span>(<span class="pl-s1">testEntity</span>.<span class="pl-en">getId</span>())){
            <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-smi">RuntimeException</span>(<span class="pl-s">"BService test...b...."</span>);
        }
    }
}</pre></div>
<blockquote>
<p dir="auto">test</p>
</blockquote>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringbootDubboDemoApplicationTests {

    @Autowired
    private ITestService testService;

    @Reference(group = &quot;test&quot;, version = &quot;1.0.0&quot;)
    private IAService iaService;
    @Reference(group = &quot;test&quot;, version = &quot;1.0.0&quot;)
    private IBService ibService;

    @Test
    public void  testDubbo(){
        System.out.println(&quot;start......&quot;);
        try {
            iaService.test(&quot;aaaa&quot;);
        }catch (Exception e){
            e.printStackTrace();
        }
        try {
            ibService.test(&quot;bbbbb&quot;);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">RunWith</span>(<span class="pl-smi">SpringRunner</span>.<span class="pl-k">class</span>)
<span class="pl-c1">@</span><span class="pl-c1">SpringBootTest</span>
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">SpringbootDubboDemoApplicationTests</span> {

    <span class="pl-c1">@</span><span class="pl-c1">Autowired</span>
    <span class="pl-k">private</span> <span class="pl-smi">ITestService</span> <span class="pl-s1">testService</span>;

    <span class="pl-c1">@</span><span class="pl-c1">Reference</span>(<span class="pl-s1">group</span> = <span class="pl-s">"test"</span>, <span class="pl-s1">version</span> = <span class="pl-s">"1.0.0"</span>)
    <span class="pl-k">private</span> <span class="pl-smi">IAService</span> <span class="pl-s1">iaService</span>;
    <span class="pl-c1">@</span><span class="pl-c1">Reference</span>(<span class="pl-s1">group</span> = <span class="pl-s">"test"</span>, <span class="pl-s1">version</span> = <span class="pl-s">"1.0.0"</span>)
    <span class="pl-k">private</span> <span class="pl-smi">IBService</span> <span class="pl-s1">ibService</span>;

    <span class="pl-c1">@</span><span class="pl-c1">Test</span>
    <span class="pl-k">public</span> <span class="pl-smi">void</span>  <span class="pl-en">testDubbo</span>(){
        <span class="pl-smi">System</span>.<span class="pl-s1">out</span>.<span class="pl-en">println</span>(<span class="pl-s">"start......"</span>);
        <span class="pl-k">try</span> {
            <span class="pl-s1">iaService</span>.<span class="pl-en">test</span>(<span class="pl-s">"aaaa"</span>);
        }<span class="pl-k">catch</span> (<span class="pl-smi">Exception</span> <span class="pl-s1">e</span>){
            <span class="pl-s1">e</span>.<span class="pl-en">printStackTrace</span>();
        }
        <span class="pl-k">try</span> {
            <span class="pl-s1">ibService</span>.<span class="pl-en">test</span>(<span class="pl-s">"bbbbb"</span>);
        }<span class="pl-k">catch</span> (<span class="pl-smi">Exception</span> <span class="pl-s1">e</span>){
            <span class="pl-s1">e</span>.<span class="pl-en">printStackTrace</span>();
        }
    }
}</pre></div>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">正常执行过后，事务应该回滚，数据库中没有保存数据</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">实际结果，a服务执行，数据库中存在记录</p>
<p dir="auto">A-aaaa 被插入数据库</p>
<p dir="auto">当注释掉A/B的循环依赖时，结果正常，数据库中没有数据</p>
<p dir="auto">详细代码见：<a href="https://github.com/softxiang/springboot-dubbo-demo">https://github.com/softxiang/springboot-dubbo-demo</a></p>
<p dir="auto">另有一个问题如下：<br>
<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a>(interfaceClass=IAService.class,group="test",version="1.0.0")<br>
<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/transactional/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/transactional">@transactional</a><br>
public class AServiceImpl implements IAService</p>
<p dir="auto">此种情况定义了一个dubbo service，是否还需要spring扫描这个service 看代码情况是不需要spring再做相应操作，但看网上很多文章包括issues中依然有人提类似问题 <a href="https://github.com/apache/incubator-dubbo/issues/2093" data-hovercard-type="issue" data-hovercard-url="/apache/dubbo/issues/2093/hovercard">#2093</a><br>
一个服务既是dubbo服务又是本地服务时，是否只需要注册为dubbo的service即可？</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Autowired/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Autowired">@Autowired</a><br>
private IBService bService;</p>
<p dir="auto">是否会自动区分本地service调用 还是dubbo service?</p>