方法中的JavaSpring自定义注释

方法中的JavaSpring自定义注释,java,spring,spring-annotations,Java,Spring,Spring Annotations,我在spring启动时遇到了一个问题,SpringContext中没有加载带有class annotation@Component和method annotation@CustomAnnotation的bean 自定义批注: `@Target(value = { ElementType.METHOD }) @Retention(value = RetentionPolicy.RUNTIME) public @interface ExcecuteRuleSet { String[] rul

我在spring启动时遇到了一个问题,SpringContext中没有加载带有class annotation@Component和method annotation@CustomAnnotation的bean

自定义批注:

`@Target(value = { ElementType.METHOD })
@Retention(value = RetentionPolicy.RUNTIME)
public @interface ExcecuteRuleSet {
    String[] ruleSetName();
    boolean onErrorStopProcess() default false;
}`
类别:

@Component
public class VehicleTypeBean implements GenericBean {

@Override @ExcecuteRuleSet(ruleSetName="rules")
public VehicleType convertToModelObject(DESRequest request) throws ServerException {
        return this.communicatorConverterService.convertToModelObject(request.getPayload(VehicleTypeRequest.class));
    }
}
`
错误:

SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [coop.tecso.bean.VehicleTypeBean] is defined
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:296)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1125)
    at coop.tecso.spring.AppContextService.getCustomBean(AppContextService.java:27)

请验证您已在spring配置文件中打开

它应该是这样的:

<context:component-scan base-package="coop.tecso"/>

组件扫描正常!如果删除该方法的自定义注释(@ExcecuteRuleSet),所有操作都正常。我不知道为什么我的自定义注释会导致de错误