This is my Test class inside spring application.
class MyTest{
@Inject
private Configuration config;
@Inject
VUtils vUtils;
@Test
method1(){
....
VUtilsP.method("test_property"); // VUtilsP is NULL here..
}
}
This below class is in jar (added as maven dependency to above)
@Component
Class VUtilsP{
@Inject
Configuration configD;
public void method(String s){
// do something
configD.getConfig(s);
}
}
application directory :
MyService
!- **src/test/java/MyTest.java**
!- External libraries
!- test-engine.jar
!- **src/java/VUtilsP.java**
I want to inject Configuration object to VUtilsP class so I can access it inside VUtilsP class.
My approach is to convert VUtilsP to a bean and inject into MyTest but this is not working. VUtilsP is null. Please let me know what I'm missing here or suggest a different approach to get it work. Thank you so much.