diff --git a/org.springframework.test/.classpath b/org.springframework.test/.classpath
index d35f01db07a..5e5a2e70be5 100644
--- a/org.springframework.test/.classpath
+++ b/org.springframework.test/.classpath
@@ -15,6 +15,7 @@
+
diff --git a/org.springframework.test/ivy.xml b/org.springframework.test/ivy.xml
index e64c205bb57..b70e01038ee 100644
--- a/org.springframework.test/ivy.xml
+++ b/org.springframework.test/ivy.xml
@@ -21,6 +21,7 @@
+
diff --git a/org.springframework.test/pom.xml b/org.springframework.test/pom.xml
index 3518579246f..332939c8b64 100644
--- a/org.springframework.test/pom.xml
+++ b/org.springframework.test/pom.xml
@@ -25,6 +25,12 @@
1.0
provided
+
+ javax.inject
+ com.springsource.javax.inject
+ 0.9.0.PFD
+ test
+
javax.persistence
persistence-api
diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java
index 91b51242bdf..e23164bcf1f 100644
--- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java
+++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java
@@ -19,9 +19,11 @@ package org.springframework.test.context.junit4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import javax.annotation.Resource;
+import javax.inject.Inject;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -48,6 +50,7 @@ import org.springframework.test.context.support.GenericXmlContextLoader;
*
* - {@link ContextConfiguration @ContextConfiguration}
* - {@link Autowired @Autowired}
+ * - {@link Inject @Inject}
* - {@link Qualifier @Qualifier}
* - {@link Resource @Resource}
* - {@link ApplicationContextAware}
@@ -59,10 +62,12 @@ import org.springframework.test.context.support.GenericXmlContextLoader;
* {@link ContextConfiguration#locations() locations} are explicitly declared
* and since the {@link ContextConfiguration#loader() ContextLoader} is left set
* to the default value of {@link GenericXmlContextLoader}, this test class's
- * dependencies will be injected via {@link Autowired @Autowired} and
- * {@link Resource @Resource} from beans defined in the
- * {@link ApplicationContext} loaded from the default classpath resource:
- * "/org/springframework/test/context/junit/SpringJUnit4ClassRunnerAppCtxTests-context.xml".
+ * dependencies will be injected via {@link Autowired @Autowired},
+ * {@link Inject @Inject}, and {@link Resource @Resource} from beans defined in
+ * the {@link ApplicationContext} loaded from the default classpath resource:
+ *
+ * "/org/springframework/test/context/junit/SpringJUnit4ClassRunnerAppCtxTests-context.xml"
+ * .
*
*
* @author Sam Brannen
@@ -93,12 +98,15 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
private Employee employee;
@Autowired
- private Pet pet;
+ private Pet autowiredPet;
+
+ @Inject
+ private Pet injectedPet;
@Autowired(required = false)
protected Long nonrequiredLong;
- @Resource()
+ @Resource
protected String foo;
protected String bar;
@@ -153,11 +161,14 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
}
@Test
- public final void verifyAnnotationAutowiredFields() {
+ public final void verifyAnnotationAutowiredAndInjectedFields() {
assertNull("The nonrequiredLong field should NOT have been autowired.", this.nonrequiredLong);
assertEquals("The quux field should have been autowired via @Autowired and @Qualifier.", "Quux", this.quux);
- assertNotNull("The pet field should have been autowired.", this.pet);
- assertEquals("Fido", this.pet.getName());
+ assertNotNull("The pet field should have been autowired.", this.autowiredPet);
+ assertNotNull("The pet field should have been injected.", this.injectedPet);
+ assertEquals("Fido", this.autowiredPet.getName());
+ assertEquals("Fido", this.injectedPet.getName());
+ assertSame("@Autowired and @Inject pet should be the same object.", this.autowiredPet, this.injectedPet);
}
@Test
@@ -176,4 +187,4 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
assertEquals("The bar method should have been wired via @Resource.", "Bar", this.bar);
}
-}
+}
\ No newline at end of file
diff --git a/org.springframework.test/test.iml b/org.springframework.test/test.iml
index a5a65c18b9a..924d7b776d9 100644
--- a/org.springframework.test/test.iml
+++ b/org.springframework.test/test.iml
@@ -24,6 +24,7 @@
+