Permalink
Browse files

Add repro case for SPR-7900

  • Loading branch information...
1 parent 7477645 commit 5d710d4b370931521424645bad8082cd77f24217 @cbeams cbeams committed Jun 22, 2011
View
43 SPR-7900/pom.xml
@@ -0,0 +1,43 @@
+<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-7900</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Spring Injection testcase</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>3.1.0.BUILD-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>spring-maven-snapshot</id>
+ <name>Springframework Maven SNAPSHOT Repository</name>
+ <url>http://maven.springframework.org/snapshot</url>
+ <snapshots><enabled>true</enabled></snapshots>
+ </repository>
+ </repositories>
+</project>
+
View
31 SPR-7900/src/test/java/org/springframework/issues/Base.java
@@ -0,0 +1,31 @@
+package org.springframework.issues;
+
+import javax.annotation.Resource;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+class Base {
+
+ private boolean resourceInjected;
+
+ @Resource
+ public void setResource(Injectable injectable) {
+ resourceInjected = true;
+ }
+
+ public boolean isResourceInjected() {
+ return resourceInjected;
+ }
+
+ private boolean autowiredInjected;
+
+ @Autowired
+ public void setAutowired(Injectable injectable) {
+ autowiredInjected = true;
+ }
+
+ public boolean isAutowiredInjected() {
+ return autowiredInjected;
+ }
+
+}
View
8 SPR-7900/src/test/java/org/springframework/issues/Injectable.java
@@ -0,0 +1,8 @@
+package org.springframework.issues;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class Injectable {
+
+}
View
27 SPR-7900/src/test/java/org/springframework/issues/InjectionTest.java
@@ -0,0 +1,27 @@
+package org.springframework.issues;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class InjectionTest {
+
+ protected Target createTarget() {
+ ApplicationContext context = new ClassPathXmlApplicationContext("classpath:/context.xml");
+ return context.getBean(Target.class);
+ }
+
+ @Test
+ public void testResource() {
+ Target t = createTarget();
+ Assert.assertTrue(t.isResourceInjected());
+ }
+
+ @Test
+ public void testAutowired() {
+ Target t = createTarget();
+ Assert.assertTrue(t.isAutowiredInjected());
+ }
+
+}
View
8 SPR-7900/src/test/java/org/springframework/issues/Target.java
@@ -0,0 +1,8 @@
+package org.springframework.issues;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class Target extends Base {
+
+}
View
14 SPR-7900/src/test/resources/context.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <context:component-scan base-package="org.springframework.issues" />
+
+ <context:annotation-config />
+
+</beans>

0 comments on commit 5d710d4

Please sign in to comment.