<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=johnemmanuel" rel="nofollow">John Emmanuel</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6632?redirect=false" rel="nofollow">SPR-6632</a></strong> and commented</p>
<p dir="auto">The first code snippet in section 3.11.1 of the spring documentation is as follows:</p>
<p dir="auto"><code class="notranslate">@Configuration</code><br>
public class AppConfig {<br>
<code class="notranslate">@Bean</code><br>
public void MyService myService() {<br>
return new MyServiceImpl();<br>
}<br>
}</p>
<p dir="auto">The method signature of the myService is incorrect. It should be</p>
<p dir="auto">public MyService myService()...</p>
<p dir="auto">Note: I did not check the forums to see if this issue has already been<br>
resolved. If already resolved I am sorry for creating this issue.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0 GA</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398101491" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/11303" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/11303/hovercard" href="https://github.com/spring-projects/spring-framework/issues/11303">#11303</a> Error in JavaConfig sample code (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=sunlxy" rel="nofollow">Sean</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-4249?redirect=false" rel="nofollow">SPR-4249</a></strong> and commented</p>
<p dir="auto">Please see the following example:</p>
<p dir="auto"><code class="notranslate">@Service</code><br>
<code class="notranslate">@Transactional</code><br>
public class AccountService {</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Autowired
private AccountDao accountDao;

public void updateLoginInfo(Account account) {
    accountDao.updateLoginInfo(account);
    someOtherStatementsMightThrowException();
}"><pre class="notranslate"><code class="notranslate">@Autowired
private AccountDao accountDao;

public void updateLoginInfo(Account account) {
    accountDao.updateLoginInfo(account);
    someOtherStatementsMightThrowException();
}
</code></pre></div>
<p dir="auto">}</p>
<p dir="auto">And everything supports the annotation is configurated:</p>
<p dir="auto">&lt;context:annotation-config /&gt;<br>
&lt;context:component-scan base-package="com.xyz" /&gt;<br>
&lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;</p>
<p dir="auto">We use <code class="notranslate">@Service</code> annotation on service bean, that is, it could be autowired to any bean depends on it.</p>
<p dir="auto">But the <code class="notranslate">@Transactional</code> annotation doesn't work, until I remove <code class="notranslate">@Service</code> annotation and explicit define the bean in context configuration xml:</p>
<p dir="auto">&lt;bean id="accountService" class="com.xyz.service.AccountService" /&gt;<br>
I'm wondering if there is any step I missed, or it supposes to work like that? Thanks.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5 final</p>