I have a
@Component
public class MyBean{
@Autowired
Bean1 bean1;
@Autowired
Bean2 bean2;
public void create(Param param1, Param param2){
SomeObject object = bean2.getDesiredResult();
}
}
where Bean2.java
has instance variables
which are autowired
-
class Bean2{
@Autowired
Bean3 bean3;
@Autowired
Bean4 bean4;
@Autowired
Bean5 bean5;
public Object getDesiredResult(){
// some code which calls method on some beans which have autowired
// beans, and this goes on and on further.
}
}
I have to test this method,
create(Param param1, Param param2)
The major problem is I continue to get these exceptons:
No qualifying bean of type
Could not autowire field
because I cannot manually component-scan
all the packages as they are so large in number. There are around 3000 java packages in the project
<context:component-scan base-package
I am using JUnit
& EasyMock
frameworks.
Please suggest.