Spring dependency injection issue
07:32 11 Oct 2013

I have a bean I am trying to configure in Spring context using Constructor injection. When I pass subclass for one of the constructor arguments, the bean is instantiated by Spring container only if I do not specify the "type" attribute. Would anybody have any idea what's wrong? Below are more specifics.

class MyClass{
   public MyClass(SomeAbstractBase absObject){
      //do stuff
   }
}

class ConcreteClass extends SomeAbstractBase{
   //
} 

Spring configs (First and second do not work but the third one using type attribute works)- Config I-



        

Config II-



        

Config III-

 
    
            
    

I get the following exception at initialization-

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedispool' defined in class path resource [cache-spring-config.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)

Why would neither of the first or second config work?

Thank you

spring