title: Spring Retryable annotation ClassNotFoundException
body: <p>I would like to use <code>@Retryable</code> annotation for <code>restTemplate</code>. I've added:</p>
  
  <pre><code>&lt;dependency&gt;
         &lt;groupId&gt;org.springframework.retry&lt;/groupId&gt;
         &lt;artifactId&gt;spring-retry&lt;/artifactId&gt;
         &lt;version&gt;1.2.1.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>as well as <code>@EnableRetry</code> to config class. I've marked method: </p>
  
  <pre><code>restTemplate.exchange(url, HttpMethod.POST, request, String.class);
  </code></pre>
  
  <p>with (in a new thread)</p>
  
  <pre><code>@Retryable(maxAttempts=4,value=Exception.class,backoff=@Backoff(delay = 2000))
  </code></pre>
  
  <p>But I'm getting error from catalina:</p>
  
  <pre><code>27-Oct-2017 18:11:41.023 SEVERE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around
      at 
  &lt;ommitted&gt;
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1103)
      ... 61 more
  Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around
      at org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory.&lt;clinit&gt;(ReflectiveAspectJAdvisorFactory.java:76)
      at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.&lt;init&gt;(AnnotationAwareAspectJAutoProxyCreator.java:53)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
      ... 63 more
  Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.annotation.Around
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
      ... 70 more
  
  27-Oct-2017 18:11:41.038 INFO [http-nio-8080-exec-1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
  </code></pre>
  
  <p>What I'm doing wrong ?</p>
  
  <p><strong>EDITED:</strong>
  I moved a little bit forward. Found that <a href="http://www.mscharhag.com/spring/spring-retry" rel="noreferrer">Spring Retry makes use of AOP</a> so I added:</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupid&gt;org.springframework&lt;/groupid&gt;
    &lt;artifactid&gt;spring-aop&lt;/artifactid&gt;
    &lt;version&gt;4.2.5.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
    &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;
    &lt;version&gt;1.8.8&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Now I'm getting different error: </p>
  
  <pre><code>27-Oct-2017 21:11:12.071 SEVERE [http-nio-8088-exec-5] org.springframework.web.servlet.DispatcherServlet.initServletBean Context initialization failed
   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeController' defined in file [(...)\HomeController.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.springframework.aop.framework.ObjenesisCglibAopProxy
      &lt;ommitted&gt;
  Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.aop.framework.ObjenesisCglibAopProxy
      at org.springframework.aop.framework.DefaultAopProxyFactory.createAopProxy(DefaultAopProxyFactory.java:60)
      at org.springframework.aop.framework.ProxyCreatorSupport.createAopProxy(ProxyCreatorSupport.java:105)
      at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:109)
      at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:468)
      at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:349)
      at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:298)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:421)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1558)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
      ... 35 more
  </code></pre>
  
  <p>To isolate the problem I created small <code>springMVC</code> project and it's the same. To keep everything simple used only few dependencies. This is output from <code>mvn dependency:tree</code>:</p>
  
  <pre><code>[INFO] com.example:store:war:0.0.1-SNAPSHOT
  [INFO] +- org.springframework:spring-webmvc:jar:4.0.3.RELEASE:compile
  [INFO] |  +- org.springframework:spring-beans:jar:4.0.3.RELEASE:compile
  [INFO] |  +- org.springframework:spring-context:jar:4.0.3.RELEASE:compile
  [INFO] |  +- org.springframework:spring-core:jar:4.0.3.RELEASE:compile
  [INFO] |  |  \- commons-logging:commons-logging:jar:1.1.3:compile
  [INFO] |  +- org.springframework:spring-expression:jar:4.0.3.RELEASE:compile
  [INFO] |  \- org.springframework:spring-web:jar:4.0.3.RELEASE:compile
  [INFO] +- javax.servlet:jstl:jar:1.2:compile
  [INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
  [INFO] +- org.springframework.retry:spring-retry:jar:1.2.1.RELEASE:compile
  [INFO] +- com.mashape.unirest:unirest-java:jar:1.4.9:compile
  [INFO] |  +- org.apache.httpcomponents:httpasyncclient:jar:4.1.1:compile
  [INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile
  [INFO] |  |  \- org.apache.httpcomponents:httpcore-nio:jar:4.4.4:compile
  [INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.5.2:compile
  [INFO] |  \- org.json:json:jar:20160212:compile
  [INFO] +- org.springframework:spring-aop:jar:4.2.5.RELEASE:compile
  [INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
  [INFO] \- org.aspectj:aspectjweaver:jar:1.8.8:compile
  </code></pre>