我在spring启动时遇到问题,在SpringContext中没有加载带有类注释@Component和方法注释@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)
答案 0 :(得分:0)