Permalink
Browse files

Add repro project for SPR-8905 as attached to JIRA

  • Loading branch information...
1 parent c934795 commit 51d88713df4123fb6f1ff090e0d995549beaa9eb @cbeams cbeams committed Dec 9, 2011
View
@@ -0,0 +1,37 @@
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.springframework.issues</groupId>
+ <artifactId>SPR-8905</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>SPR-8905</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <spring.version>3.0.6.RELEASE</spring.version>
+ </properties>
+</project>
@@ -0,0 +1,5 @@
+package test;
+
+public class AbstractDao {
+
+}
@@ -0,0 +1,20 @@
+package test;
+
+public abstract class AbstractService<D extends AbstractDao> {
+
+ protected D dao;
+
+ public abstract void setDao(D dao);
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("AbstractService [dao=");
+ builder.append(dao);
+ builder.append("]");
+ return builder.toString();
+ }
+
+
+
+}
@@ -0,0 +1,8 @@
+package test;
+
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class FirstDao extends AbstractDao {
+
+}
@@ -0,0 +1,15 @@
+package test;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class FirstService extends AbstractService<FirstDao> {
+
+ @Override
+ @Autowired
+ public void setDao(FirstDao dao) {
+ this.dao = dao;
+ }
+
+}
@@ -0,0 +1,8 @@
+package test;
+
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class SecondDao extends AbstractDao {
+
+}
@@ -0,0 +1,15 @@
+package test;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SecondService extends AbstractService<SecondDao> {
+
+ @Override
+ @Autowired
+ public void setDao(SecondDao dao) {
+ this.dao = dao;
+ }
+
+}
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.springframework.org/schema/beans" 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.0.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+ ">
+ <context:annotation-config />
+ <context:component-scan base-package="test" />
+</beans>
@@ -0,0 +1,24 @@
+package test;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+ @ContextConfiguration("classpath:applicationContext.xml")
+public class ContextTest {
+
+ @Autowired
+ FirstService firstService;
+
+ @Autowired
+ SecondService secondService;
+
+ @Test
+ public void testMe() {
+ System.out.println(firstService);
+ System.out.println(secondService);
+ }
+}

0 comments on commit 51d8871

Please sign in to comment.