[英]Java Spring Custom annotation in method
我在春季啟動時遇到問題,帶有類注釋@Component和方法注釋@CustomAnnotation的bean未加載到SpringContext中
自定義注釋:
`@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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.