Class doesn't contain matching constructor for autowiring

dependency-injection, java, spring

Solution

This is a bug in IntelliJ that is fixed in 13.1. http://youtrack.jetbrains.com/issue/IDEA-120977

Problem

I have two classes ``` public abstract class AbstractDAO<T> { private final MyExecutor<T> myExecutor; private final Class<T> clazz; public AbstractDAO(MyExecutor<T> myExecutor, Class<T> clazz) { this.myExecutor = myExecutor; this.clazz = clazz; } } ``` and ``` @Component public class MyDAOImpl extends AbstractDAO<Manager> { private final SessionManager sessionManager; private final MyExecutor<Manager> myExecutor; @Autowired public MyDAOImpl(SessionManager sessionManager, MyExecutor<Manager> myExecutor) { super(myExecutor, Manager.class); this.sessionManager = sessionManager; this.myExecutor= myExecutor; } } ``` I got an error at the definition of the abstract class saying that: "Class doesn't contain matching constructor for autowiring". All I did is added an additional constructor parameter to the constructor of AbstractDAO which is a Class. I need this because I didn't find a way to detect this out from T at run time (stackflow search says there isn't one). How can I fix this? How can I pass the Class information which can only be determined in the implementation class? Many thanks

Original source

Related problems