This specific class's member private fields which are annotated @autowired are within a service JAR, and when I am trying to get an instance of the class within my code, the @autowired member is always coming back as null. I have the below component-scan statements within my project's context.xml, which is trying to lookup the base-package within the JAR, but still it appears nulls are being injected into the annotated members. The JAR internally also has a context.xml which has the same component-scan entries as below. The JAR source code cannot be changed now, is there anything I am missing?
<!-- local WEB-INF/spring-context/spring-application-context.xml -->
<context:annotation-config />
<context:component-scan base-package="blah.blah" />
//this code within my project
//wjc.getMethod() dereferencing comes back null
public class A{
WithinJARInterface wjc = new WithinJARInterfaceImpl()
List someObject = wjc.getMethod()
}
//this code interface within JAR
public interface WithinJARInterface{
public List getMethod() throws Exception();
}
//this code within JAR
public class WithinJARInterfaceImpl implements WithinJARInterface{
//below member always comes back NULL
@Autowired
private JARService jService;
public List getMethod(){.....}
}
public interface JARService{
public List method1();
}
@Service("JARService")
public class JARServiceImpl implments JARService {
public List method1(){ }
}