Spring context:component-scan fails to find components in another Eclipse project dependency referenced in POM Spring context:component-scan fails to find components in another Eclipse project dependency referenced in POM spring spring

Spring context:component-scan fails to find components in another Eclipse project dependency referenced in POM


Be sure that in the deployment assembly (right click your web project and select "deployment assembly" of your myclient project it is configured to deploy the jar that is outputted by the myservices project. If you are using maven, the m2e, m2e-wtp project configurators should do this deployment assembly setup automatically.

Once you have deployment assembly settings properly configured, now when you deploy a project to your server using the Eclispe server adapter publish mechanism, everything should get deployed and the myservices jar would get placed in the right spot for your myclient project.

But make sure you the latest version of m2e-wtp installed. This way your configuration in your pom.xml and deployment assembly will get correctly configured.


Try splitting your application-context.xml into 2 separate files:

<context-param>  <param-name>contextConfigLocation</param-name>  <param-value>classpath:service-context.xml,classpath:client-context.xml</param-value></context-param>

myservices/src/main/resources/service-context.xml:

<context:component-scan base-package="com.myproject.myservices"/>

myclient/src/main/resources/client-context.xml:

<context:component-scan base-package="com.myproject.myclient"/>


Try this :

<context:component-scan base-package="com.myproject"/>