相关疑难解决方法(0)

组件扫描接口上的自定义注释

我有一个组件扫描配置如下:

   @Configuration
   @ComponentScan(basePackageClasses = {ITest.class},
                  includeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, value = JdbiRepository.class)})
   public class MyConfig {

   }
Run Code Online (Sandbox Code Playgroud)

基本上我想创建具有JdbiRepository注释的扫描界面

@JdbiRepository
public interface ITest {
  Integer deleteUserSession(String id);
}
Run Code Online (Sandbox Code Playgroud)

我想创建我的接口的代理实现.为此,我注册了一个SmartInstantiationAwareBeanPostProcessor基本上创建必要实例的自定义,但上面的配置不扫描具有JdbiRepository注释的接口.

如何通过自定义注释扫描界面?

编辑:

似乎org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider#isCandidateComponent只接受具体的课程.

/**
 * Determine whether the given bean definition qualifies as candidate.
 * <p>The default implementation checks whether the class is concrete
 * (i.e. not abstract and not an interface). Can be overridden in subclasses.
 * @param beanDefinition the bean definition …
Run Code Online (Sandbox Code Playgroud)

spring

5
推荐指数
2
解决办法
8683
查看次数

标签 统计

spring ×1