title: Use Bean from an another module
body: <p>I am creating a Batch application to put some data from a web-service on the database.
  To do this I need to convert DTO's received by the web-service on utilizable classes. This is possible using some mapper defined in an other module.</p>
  <p>When I tried to <strong>@Autowired</strong> the mapper I have an Exception and I don't find how to pass out.</p>
  <pre><code>Exception in thread &quot;main&quot; org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.execution.batch.processor.UtilisateurProcessor com.execution.batch.jobConfiguration.JobConfigurationAbstract.utilisateurProcessor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'utilisateurProcessor': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.execution.server.common.mapper.UtilisateurMapper com.execution.batch.processor.UtilisateurProcessor.utilisateurMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.execution.server.common.mapper.UtilisateurMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  **Caused by**: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.execution.batch.processor.UtilisateurProcessor com.execution.batch.jobConfiguration.JobConfigurationAbstract.utilisateurProcessor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'utilisateurProcessor': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.execution.server.common.mapper.UtilisateurMapper com.execution.batch.processor.UtilisateurProcessor.utilisateurMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.execution.server.common.mapper.UtilisateurMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  **Caused by**: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'utilisateurProcessor': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.execution.server.common.mapper.UtilisateurMapper com.execution.batch.processor.UtilisateurProcessor.utilisateurMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.execution.server.common.mapper.UtilisateurMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  **Caused by**: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.execution.server.common.mapper.UtilisateurMapper com.execution.batch.processor.UtilisateurProcessor.utilisateurMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.execution.server.common.mapper.UtilisateurMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  **Caused by**: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.execution.server.common.mapper.UtilisateurMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  </code></pre>
  <p>The mappers are working fine in their module. I can @Autowierdd them and use it without problems. And the my batch is working fine if I don't @Autowierd the mapper.</p>
  <p>Someone have an idea?</p>
  <p>Thanks!</p>
  <p><strong>EDIT</strong></p>
  <p>My configuration is on my job configuration class :</p>
  <pre><code>@Configuration
  @EnableBatchProcessing
  @ComponentScan(basePackages = {&quot;com.execution.batch&quot;})
  </code></pre>
  <p>I tried to put : <code>@ComponentScan(basePackages = {&quot;com.execution.batch&quot;, &quot;com.execution.serve&quot;})</code></p>
  <p>But if I do that I have errors reported to the injection of the job's bean :</p>
  <pre><code>Exception in thread &quot;main&quot; org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.batch.core.configuration.annotation.StepBuilderFactory com.execution.batch.jobConfiguration.JobConfigurationAbstract.stepBuilderFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stepBuilders' defined in class path resource [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.configuration.annotation.StepBuilderFactory]: Factory method 'stepBuilders' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jobRepository' defined in com.execution.batch.jobConfiguration.JobConfiguration: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager]: : No qualifying bean of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
  Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.batch.core.configuration.annotation.StepBuilderFactory com.execution.batch.jobConfiguration.JobConfigurationAbstract.stepBuilderFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stepBuilders' defined in class path resource [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.configuration.annotation.StepBuilderFactory]: Factory method 'stepBuilders' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jobRepository' defined in com.execution.batch.jobConfiguration.JobConfiguration: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager]: : No qualifying bean of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stepBuilders' defined in class path resource [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.configuration.annotation.StepBuilderFactory]: Factory method 'stepBuilders' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jobRepository' defined in com.execution.batch.jobConfiguration.JobConfiguration: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager]: : No qualifying bean of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
  Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jobRepository' defined in com.execution.batch.jobConfiguration.JobConfiguration: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager]: : No qualifying bean of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
  Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.batch.support.transaction.ResourcelessTransactionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
  </code></pre>
  <p>Like I said, separately the to modules work fine.</p>
  <ul>
  <li>when I scan the server and the batch module the scan of the batch don't work.</li>
  <li>When I scan just the batch module, the server module don't work because isn't scan I think.</li>
  </ul>