<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-6567?redirect=false" rel="nofollow">SPR-6567</a></strong> and commented</p>
<p dir="auto">Why don't you add AnnotationContextLoader that supports annotation configuration based TestContext.</p>
<p dir="auto">for example. If there is an annotation configuration like this</p>
<p dir="auto"><code class="notranslate">@Configuration</code><br>
public class SpringAnnotationConfigTestAppConfig {</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Bean
public String name(){
    return &quot;keesun&quot;;
}"><pre class="notranslate"><code class="notranslate">@Bean
public String name(){
    return "keesun";
}
</code></pre></div>
<p dir="auto">}</p>
<p dir="auto">and, at the same package, I can make test like this.</p>
<p dir="auto"><code class="notranslate">@RunWith</code>(SpringJUnit4ClassRunner.class)<br>
<code class="notranslate">@ContextConfiguration</code>(loader = AnnotationContextLoader.class, locations = {"."})<br>
public class SpringAnnotationConfigTest {</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Autowired ApplicationContext ac;
@Autowired String name;

@Test
public void di(){
    assertNotNull(ac);
    assertThat(name, is(&quot;keesun&quot;));
}"><pre class="notranslate"><code class="notranslate">@Autowired ApplicationContext ac;
@Autowired String name;

@Test
public void di(){
    assertNotNull(ac);
    assertThat(name, is("keesun"));
}
</code></pre></div>
<p dir="auto">}</p>
<p dir="auto">then, conventionally SpringJUnit4ClassRunner finds SpringAnnotationConfigTest + "AppConfig.java" for an annotation configuration.</p>
<p dir="auto">Of course, It makes sence that we sould use 'locations' attribute of <code class="notranslate">@ContextConfigruation</code> like these.</p>
<p dir="auto"><code class="notranslate">@ContextConfiguration</code>(loader = AnnotationContextLoader.class, locations = {"/sandbox/springtest/sample/SpringAnnotationConfigTestAppConfig.java"})<br>
<code class="notranslate">@ContextConfiguration</code>(loader = AnnotationContextLoader.class, locations = {"/sandbox/springtest/sample/"})<br>
<code class="notranslate">@ContextConfiguration</code>(loader = AnnotationContextLoader.class, locations = {"/sandbox/springtest/sample"})<br>
<code class="notranslate">@ContextConfiguration</code>(loader = AnnotationContextLoader.class, locations = {"./SpringAnnotationConfigTestAppConfig.java"})<br>
<code class="notranslate">@ContextConfiguration</code>(loader = AnnotationContextLoader.class, locations = {"./"})<br>
<code class="notranslate">@ContextConfiguration</code>(loader = AnnotationContextLoader.class, locations = {"."})</p>
<p dir="auto">with '.Java' locations can be used to AnnotationConfigurationApplicationContext.regist(), and without '.java' locations will be used to AnnotationConfigurationApplicationContext.scan().</p>
<p dir="auto">What do you think about this?</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0 RC3</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/16009/AnnotationContextLoader.java" rel="nofollow">AnnotationContextLoader.java</a> (<em>5.89 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/16010/AnnotationContextLoaderTest.java" rel="nofollow">AnnotationContextLoaderTest.java</a> (<em>1.95 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/16011/SpringAnnotationConfigTest.java" rel="nofollow">SpringAnnotationConfigTest.java</a> (<em>1.61 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/16012/SpringAnnotationConfigTestAppConfig.java" rel="nofollow">SpringAnnotationConfigTestAppConfig.java</a> (<em>476 bytes</em>)</li>
</ul>
<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="398097973" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10852" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10852/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10852">#10852</a> Provide TestContext support for <code class="notranslate">@Configuration</code> classes (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto">3 votes, 5 watchers</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=stullsanders" rel="nofollow">Jeff Sanders</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-9837?redirect=false" rel="nofollow">SPR-9837</a></strong> and commented</p>
<p dir="auto">"http-0.0.0.0-8080-7":at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:184) - waiting to lock &lt;455368173&gt; (a java.util.concurrent.ConcurrentHashMap@1b245ded ) which is held by http-0.0.0.0-8080-4</p>
<p dir="auto">The above error happens a few times and stops the Web App from processing. We have to restart JBoss to get the app back up and processing requests.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.2 M1, 3.2 M2</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/20528/deadlock+info+Document1.txt" rel="nofollow">deadlock info Document1.txt</a> (<em>1.94 kB</em>)</li>
</ul>
<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="398113127" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/13117" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/13117/hovercard" href="https://github.com/spring-projects/spring-framework/issues/13117">#13117</a> Performance bottleneck and potential thread deadlock in DefaultSingletonBeanRegistry (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto">0 votes, 5 watchers</p>