i have a problem when spring startup, the bean with class annotation @Component and method annotation @CustomAnnotation is not load in SpringContext
custom annotation:
`@Target(value = { ElementType.METHOD })
@Retention(value = RetentionPolicy.RUNTIME)
public @interface ExcecuteRuleSet {
String[] ruleSetName();
boolean onErrorStopProcess() default false;
}`
class:
@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));
}
}
`
error:
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)
Please verify you have turned on component scanning in your spring configuration file.
It should look something like this:
<context:component-scan base-package="coop.tecso"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.