<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=yozh" rel="nofollow">Stepan Koltsov</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-8528?redirect=false" rel="nofollow">SPR-8528</a></strong> and commented</p>
<p dir="auto">Spring javaconf by default allows to override bean definitions. This could cause hard to find bean name collisions made by mistake in large projects.</p>
<p dir="auto">To avoid this problem Spring provides GenericApplicationContext.setAllowBeanDefinitionOverriding(false). This helps to resolve name collision problems, but it makes impossible (or very hard) reuse of context configuration with minor adjustments (reuse 100 beans, redefine one or two).</p>
<p dir="auto">I propose <code class="notranslate">@Bean</code>(override=true) parameter.</p>
<p dir="auto">With <code class="notranslate">@Bean</code>(override=true) new bean is only registered if there already exists a bean with same name. Previous bean definition is removed during this bean registration.</p>
<p dir="auto">It is an error if <code class="notranslate">@Bean</code>(override=true) overrides nothing.</p>
<p dir="auto">allowBeanDefinitionOverriding value is ignored when <code class="notranslate">@Bean</code>(override=true)</p>
<p dir="auto"><code class="notranslate">@Bean</code>(override=true) works for context similarly to how <code class="notranslate">@Override</code> works for classes and interfaces.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.1 M2</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="398110303" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/12637" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/12637/hovercard" href="https://github.com/spring-projects/spring-framework/issues/12637">#12637</a> Support profile exclusivity and/or bean definition finality (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=keesun" rel="nofollow">Keesun Baik</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-3405?redirect=false" rel="nofollow">SPR-3405</a></strong> and commented</p>
<p dir="auto">Chapter 8<br>
8.3.5.1's <code class="notranslate">@ExpectedException</code></p>
<p dir="auto">and if &lt;&lt;an an&gt;&gt; instance of the exception is thrown during the test method execution then the test is considered to have passed (likewise if &lt;&lt;an an&gt;&gt; instance of the exception is not thrown during the test method execution then the test is considered to have failed.</p>
<p dir="auto">there are two "an"s</p>
<p dir="auto">Chapter 9<br>
9.6.1.1. Specifying transaction settings's example code has an double quater at the end.</p>
<p dir="auto">&lt;bean id="sharedTransactionTemplate"<br>
class="org.springframework.transaction.support.TransactionTemplate&gt;<br>
&lt;property name="isolationLevelName" value="ISOLATION_READ_UNCOMMITTED"/&gt;<br>
&lt;property name="timeout" value="30"/&gt;<br>
&lt;/bean&gt;"</p>
<p dir="auto">Fially, instances of the TransactionTemplate class are threadsafe, in that instaces do not maintain any conversational state.</p>
<p dir="auto">Here also has an misspell "in that instaces do" =&gt; "in that instances do"</p>
<p dir="auto">Chapter 12<br>
12.2.4. Implementing Spring-based DAOs without callbacks's Example Code has some wrong code.</p>
<p dir="auto">public class ProductDaoImpl extends HibernateDaoSupport implements ProductDao {</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="public Collection loadProductsByCategory(String category)
        throws DataAccessException, MyException {

    Session session = getSession(getSessionFactory(), false);
    try {
        List result = session.find(
            &quot;from test.Product product where product.category=?&quot;,
            category, Hibernate.STRING);
        if (result == null) {
            throw new MyException(&quot;invalid search result&quot;);
        }
        return result;
    }
    catch (HibernateException ex) {
        throw convertHibernateAccessException(ex);
    }
}"><pre class="notranslate"><code class="notranslate">public Collection loadProductsByCategory(String category)
        throws DataAccessException, MyException {

    Session session = getSession(getSessionFactory(), false);
    try {
        List result = session.find(
            "from test.Product product where product.category=?",
            category, Hibernate.STRING);
        if (result == null) {
            throw new MyException("invalid search result");
        }
        return result;
    }
    catch (HibernateException ex) {
        throw convertHibernateAccessException(ex);
    }
}
</code></pre></div>
<p dir="auto">}</p>
<p dir="auto">HibernateDaoSupport doesn't have "getSession(SessionFactory sessionFactory, boolean allowCreate)" method.<br>
And org.hibernate.Session doesn't have "find" method. and org.hibernate.classic.Session class was deprecated so fix the code like following code please.</p>
<p dir="auto">Session session = getSession(false);<br>
try {<br>
List result = session.createQuery("from test.Product product where product.category=?").setString(0, category).list();<br>
if (result == null) {<br>
throw new MyException("invalid search result");<br>
}<br>
return result;<br>
}</p>
<p dir="auto">Sorry for my ugly English. :)</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.4</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="398077829" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/8138" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/8138/hovercard" href="https://github.com/spring-projects/spring-framework/issues/8138">#8138</a> 12.2.4 Hibernate documentation calls an unknown method (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>