I have two classes
public abstract class AbstractDAO {
private final MyExecutor myExecutor;
private final Class clazz;
public AbstractDAO(MyExecutor myExecutor, Class clazz) {
this.myExecutor = myExecutor;
this.clazz = clazz;
}
}
and
@Component
public class MyDAOImpl extends AbstractDAO {
private final SessionManager sessionManager;
private final MyExecutor myExecutor;
@Autowired
public MyDAOImpl(SessionManager sessionManager, MyExecutor 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?c class Example { private final Logger logger; @Autowired public Example(final Logger logger) { this.logger = logger; }} I've found the FactoryBean class, which I've implemented. But the problem is that I cannot get any info
Many thanks
java
spring
dependency-injection
edited Feb 16 '14 at 16:17 asked Feb 16 '14 at 15:39
Kevin 1,469 7 36 60 It is a compile time error. No stack stace. Thanks. –
Kevin Feb 16 '14 at 15:44 You might want to read:
stackoverflow.com/questions/3153546/… and
stackoverflow.com/questions/19414734/spring-autowired-usage –
pedromss Feb 16 '14 at 16:28 Your code, as shown, compiles fine. –
Sotirios Delimanolis Feb 16 '14 at 17:26 It only compiles if I add a @Autowired in the constructor of the abstract class AbstractDAO. Otherwise, it won't. I want to know why it is like this. Many thanks. –
Kevin Feb 16 '14 at 17:28 I think you are misunderstanding what compilation is. Your error is not a compilation error (unless there is something seriously missing from your question). –
Sotirios Delimanolis Feb 16 '14 at 17:38
|
show more comment
1 Answers
1
---Accepted---Accepted---Accepted---
This is a bug in IntelliJ that is fixed in 13.1. http://youtrack.jetbrains.com/issue/IDEA-120977
answered Mar 9 '14 at 18:45
robert_difalco 2,378 1 16 34
|
A_UMBRELLA = ApplicationContextProvider.getApplicationContext().getBean(ParametrosInfraComponent.class) .findByIdParametroLikeAsMap("%UMBRELLA%"); private final HttpConnectionRest conexaoHttp; @Autowired @Qualifier