해당 프로젝트는 다중 모듈을 사용하고 있음

POM에도 관련 모듈이 잘 등록되어있고, 소스코드 상에서는 문제가 없었으나 어노테이션 오류 발생

***************************
APPLICATION FAILED TO START
***************************

Description:

Field xxxxxRepository in xxx.xxx.xx.service.xxxxxService required a bean of type 'xxx.xxx.xx.repository.xxxxxRepository' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'xxx.xxx.xx.repository.xxxxxRepository' in your configuration.


Process finished with exit code 1

 

관련 내용을 찾아보니 해당 모듈이 스캔되지 않은 문제일 수 있다고 함

다음과 같이 EntityScan, EnableJpsRepositories에 관련 패키지를 추가하여 해결함

@EnableBatchProcessing
@EnableConfigurationProperties({EsProperties.class, SmtpProperties.class, EmailProperties.class})
@EntityScan(basePackages = {"xxx.xxx.xx.aaa.domain", "xxx.xxx.xx.bbb.domain"})
@SpringBootApplication(scanBasePackages = "xxx.xxx.xx")
@EnableJpaRepositories(basePackages = {"xxx.xxx.xx.aaa.repository", "xxx.xxx.xx.bbb.repository"})
public class BatchApplication {

    public static void main(String[] args)
    {
        SpringApplication.run(BatchApplication.class, args);
    }
}