Component Scan for custom annotation on Interface

前端 未结 3 1518
野趣味
野趣味 2021-01-18 06:32

I have a component scan configuration as this:

   @Configuration
   @ComponentScan(basePackageClasses = {ITest.class},
                  includeFilters = {@C         


        
3条回答
  •  滥情空心
    2021-01-18 06:57

    As I said earlier, component scan is working only for concrete classes.

    In order to solve my problem I have followed these steps:

    1. Implemented a custom org.springframework.context.annotation.ImportBeanDefinitionRegistrar
    2. Created a custom annotation EnableJdbiRepositories which is importing my custom importer.
    3. Extended ClassPathScanningCandidateComponentProvider in order to scan interfaces too. My custom importer used this class to scan interfaces too.

提交回复
热议问题