forked from spring-attic/spring-framework-issues
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPR-9255] Illustrate part of the problem. Test fails 100% of the tim…
…e with a BeanCurrentlyInCreationException, even though there's no circular dependency
- Loading branch information
1 parent
4a9d255
commit 6fa97fa
Showing
9 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,62 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.springframework.issues</groupId> | |||
<artifactId>SPR-9255</artifactId> | |||
<version>1.0-SNAPSHOT</version> | |||
<packaging>jar</packaging> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.springframework</groupId> | |||
<artifactId>spring-context</artifactId> | |||
<version>3.2.0.BUILD-SNAPSHOT</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>log4j</groupId> | |||
<artifactId>log4j</artifactId> | |||
<version>1.2.16</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>4.8</version> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
<repositories> | |||
<repository> | |||
<id>spring-maven-snapshot</id> | |||
<name>Springframework Maven Snapshot Repository</name> | |||
<url>http://repo.springsource.org/snapshot</url> | |||
<snapshots><enabled>true</enabled></snapshots> | |||
</repository> | |||
</repositories> | |||
<properties> | |||
<project.build.sourceEncoding>UTF8</project.build.sourceEncoding> | |||
</properties> | |||
<build> | |||
<plugins> | |||
<plugin> | |||
<artifactId>maven-compiler-plugin</artifactId> | |||
<version>2.3.2</version> | |||
<configuration> | |||
<source>1.6</source> | |||
<target>1.6</target> | |||
</configuration> | |||
</plugin> | |||
<plugin> | |||
<artifactId>maven-surefire-plugin</artifactId> | |||
<version>2.7.2</version> | |||
<configuration> | |||
<includes> | |||
<include>**/*Tests.java</include> | |||
</includes> | |||
<excludes> | |||
<exclude>**/*Abstract*.java</exclude> | |||
</excludes> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
</project> | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
package org.springframework.issues; | |||
|
|||
public class Alpha { | |||
|
|||
} |
30 changes: 30 additions & 0 deletions
30
SPR-9255/src/main/java/org/springframework/issues/AlphaFactoryBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,30 @@ | |||
package org.springframework.issues; | |||
|
|||
import org.springframework.beans.factory.FactoryBean; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
|
|||
public final class AlphaFactoryBean implements FactoryBean<Alpha> { | |||
|
|||
private final Alpha alpha = new Alpha(); | |||
|
|||
@Autowired | |||
public AlphaFactoryBean(Bravo bravo) { | |||
|
|||
} | |||
|
|||
@Override | |||
public Alpha getObject() throws Exception { | |||
return this.alpha; | |||
} | |||
|
|||
@Override | |||
public Class<?> getObjectType() { | |||
return Alpha.class; | |||
} | |||
|
|||
@Override | |||
public boolean isSingleton() { | |||
return true; | |||
} | |||
|
|||
} |
14 changes: 14 additions & 0 deletions
14
SPR-9255/src/main/java/org/springframework/issues/Bravo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,14 @@ | |||
package org.springframework.issues; | |||
|
|||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Component; | |||
|
|||
@Component | |||
public final class Bravo { | |||
|
|||
@Autowired | |||
public Bravo(Charlie charlie) { | |||
|
|||
} | |||
|
|||
} |
13 changes: 13 additions & 0 deletions
13
SPR-9255/src/main/java/org/springframework/issues/Charlie.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
package org.springframework.issues; | |||
|
|||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Component; | |||
|
|||
@Component | |||
public class Charlie { | |||
|
|||
@Autowired | |||
public Charlie() { | |||
} | |||
|
|||
} |
Empty file.
20 changes: 20 additions & 0 deletions
20
SPR-9255/src/test/java/org/springframework/issues/ReproTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
package org.springframework.issues; | |||
|
|||
import org.junit.Test; | |||
import org.springframework.context.support.GenericXmlApplicationContext; | |||
|
|||
/** | |||
* Unit test that reproduces an issue reported against SPR JIRA. @Test methods within | |||
* need not pass with the green bar! Rather they should fail in such a way that | |||
* demonstrates the reported issue. | |||
*/ | |||
public class ReproTests { | |||
|
|||
@Test | |||
public void repro() { | |||
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(); | |||
ctx.load("classpath:org/springframework/issues/ReproTests-context.xml"); | |||
ctx.refresh(); | |||
} | |||
|
|||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
log4j.rootCategory=ERROR, stdout | |||
|
|||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | |||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | |||
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n | |||
|
|||
log4j.category.org.springframework=WARN |
13 changes: 13 additions & 0 deletions
13
SPR-9255/src/test/resources/org/springframework/issues/ReproTests-context.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<beans xmlns="http://www.springframework.org/schema/beans" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xmlns:context="http://www.springframework.org/schema/context" | |||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd | |||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> | |||
|
|||
<context:component-scan base-package="org.springframework.issues"/> | |||
<context:annotation-config/> | |||
|
|||
<bean class="org.springframework.issues.AlphaFactoryBean"/> | |||
|
|||
</beans> |