Spring component scan for nested jar
applicationcontext, autowired, jar, java, spring
Solution
Make sure inner.jar (or whatever you name it to) exist on your classpath (either by adding to maven dependency, eclipse project settings, using -cp jvm command line arguments, etc), and just refer to the package name of the classes inside inner.jar you want to include.
Also make sure you don't get confused between jar, base package and fully-qualified class name. If I have a class `com.mycoolcompany.service.Booya` inside Blah.jar, typically I just need to do
<context:component-scan base-package="com.mycoolcompany.service.*" />
And ensure Blah.jar is on the parent project's classpath
Problem
Basically I have this Outer.jar, declared in it is an application context with a component scan: ``` <context:component-scan base-package="x.y.z.class" /> ``` However this `x.y.z.class` is in an inner.jar which is a dependency of outer.jar, I'm getting an error that class not found `.../Outer.jar/x/y/z/class` , how can specify to check in the inner.jar? UPDATE: Initialize Application context as: ``` org.springframework.context.ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); exception: I/O failure during classpath scanning; nested exception is java.io.FileNotFoundException: ..\default\deploy\test.war\WEB-INF\lib\inner.jar\x\y\z and it says inner.jar/x/y/z/class not found ``` Outer.jar has inner.jar as the dependency