Component Scan for custom annotation on Interface

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

I have a component scan configuration as this:

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


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 07:13

    Instead of scanning an annotated interface, you can create a dummy implementation and annotate it accordingly:

    @JdbiRepository
    public class DummyTest implements ITest {
      public Integer deleteUserSession(String id) {
        // nothing here, just being dummy
      }
    }
    

    Then, scan the dummy implementation basePackageClasses = {DummyTest.class}.

    It's a bit of a workaround, but very simple and good enough for test purposes (as seems to be here).

提交回复
热议问题