title: spring, aop, batch retry, exception: expected single bean but found 0
body: <p>I changed the code. the reason is bean can not be build.</p>
  
  <p>If i don't add the retry, it works. If i don't add the retry, it works.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans
  xmlns="www.springframework.org/schema/beans"
  xmlns:xsi="www.w3.org/2001/XMLSchema-instance"
  xmlns:util="www.springframework.org/schema/util"
  xmlns:aop="www.springframework.org/schema/aop"
  xmlns:context="www.springframework.org/schema/context"
  xsi:schemaLocation="
      www.springframework.org/schema/beans www.springframework.org/schema/beans/spring-beans-3.0.xsd
      www.springframework.org/schema/util www.springframework.org/schema/util/spring-util-3.0.xsd
      www.springframework.org/schema/aop www.springframework.org/schema/aop/spring-aop-3.0.xsd
      www.springframework.org/schema/context www.springframework.org/schema/context/spring-context-3.0.xsd
  "&gt;
  &lt;bean class="com.company.team.task.taskMonitorImpl"/&gt;
  &lt;aop:config&gt;
      &lt;aop:pointcut id="taskCheck" expression="execution(* com.company.team.task.taskMonitorImpl.*(..))" /&gt;
      &lt;aop:advisor pointcut-ref="taskCheck" advice-ref="taskRetryAdvice" /&gt;
  &lt;/aop:config&gt;
  
  &lt;bean id="taskRetryAdvice" class="org.springframework.batch.retry.interceptor.RetryOperationsInterceptor"&gt;
      &lt;property name="RetryOperations" ref="taskBatchRetryTemplate" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="taskBatchRetryTemplate" class="org.springframework.batch.retry.support.RetryTemplate"&gt;
     &lt;property name="retryPolicy" ref="taskBatchRetryPolicy" /&gt;
     &lt;property name="backOffPolicy" ref="ExponentialBackOffPolicy" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="taskBatchRetryPolicy" class="org.springframework.batch.retry.policy.SimpleRetryPolicy"&gt;
      &lt;constructor-arg index="0" value="3"/&gt;
      &lt;constructor-arg index="1"&gt;
          &lt;map&gt;
              &lt;entry key="java.lang.RuntimeException" value="true"/&gt;
          &lt;/map&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean&gt;
  
  &lt;bean id="ExponentialBackOffPolicy" class="org.springframework.batch.retry.backoff.ExponentialBackOffPolicy"&gt;
      &lt;property name="initialInterval" value="300" &gt;
          &lt;description&gt;Initial sleep interval value, default 300 ms&lt;/description&gt;
      &lt;/property&gt;
      &lt;property name="maxInterval" value="30000" &gt;
          &lt;description&gt;The maximum value of the backoff period in milliseconds.&lt;/description&gt;
      &lt;/property&gt;
      &lt;property name="multiplier" value="2.0" &gt;
          &lt;description&gt;The value to increment the exp seed with for each retry attempt.&lt;/description&gt;
      &lt;/property&gt;
   &lt;/bean&gt;
  
  &lt;!--&lt;context:annotation-config /&gt;--&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
  log4j:WARN Please initialize the log4j system properly.
  INFO: Detected JCL Provider: Commons Logging [commons-logging-api-1.1.1.jar]
  INFO: Detected JCL Implementation: Commons Logging [commons-logging-adapters-1.1.1.jar]
  INFO: JCL output is LOG4J
  INFO: log4j.appender.APPLICATION.File = /home/me/workspace/src/teamListingDestinationWorkflow/build/private/var/output/logs/teamListingDestinationWorkflow.log
  Exception in thread "main" java.lang.ExceptionInInitializerError
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.company.team.teamListingDstWorkflow.teamListingDstWorkflowMain#0': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.company.team.task.taskMonitorImpl com.company.team.teamListingDstWorkflow.teamListingDstWorkflowMain.mon; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.company.team.task.taskMonitorImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
      at com.company.team.teamListingDstWorkflow.teamListingDstWorkflowMain.&lt;clinit&gt;(teamListingDstWorkflowMain.java:29)
      Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.company.team.task.taskMonitorImpl com.company.team.teamListingDstWorkflow.teamListingDstWorkflowMain.mon; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.company.team.task.taskMonitorImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508)
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
      ... 13 more
      Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.company.team.task.taskMonitorImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:480)
      ... 15 more
  </code></pre>
  
  <p>my question: let "retry" works</p>
  
  <hr>
  
  <p>Thanks in advance.</p>