0

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)
Kara
  • 6,115
  • 16
  • 50
  • 57

1 Answers1

0

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 component scanning is ok! If I remove the custom annotation (@ExcecuteRuleSet) of the method, all works fine. I don't know why my custom annotation cause de error – joel.delvalle Feb 24 '14 at 13:14