title: Spring Framework: No BeanFactory available anymore (probably due to serialization)
body: <p>I am trying to convert an xml configured bean to JavaConfig.
  The xml version is working, but I keep getting error when using the JavaConfig version:</p>
  
  <pre><code>Caused by: java.lang.IllegalStateException: No BeanFactory available anymore (probably due to serialization) - cannot resolve interceptor names [cacheAdvisor]
  at org.springframework.aop.framework.ProxyFactoryBean.initializeAdvisorChain(ProxyFactoryBean.java:423)
  </code></pre>
  
  <p>Working xml configuration:</p>
  
  <pre><code>&lt;bean id="contentLogic" class="org.springframework.aop.framework.ProxyFactoryBean"&gt;
      &lt;property name="interceptorNames"&gt;
          &lt;list&gt;
              &lt;value&gt;cacheAdvisor&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="proxyInterfaces" value="com.company.logic.ContentLogic"/&gt;
      &lt;property name="target"&gt;
          &lt;bean class="com.company.logic.ContentLogicImpl"/&gt;
      &lt;/property&gt; 
  &lt;/bean&gt;
  </code></pre>
  
  <p>Not working JavaConfig:</p>
  
  <pre><code>@Configuration
  public class SpringConfiguration {
  
      @Bean
      public ContentLogic getRealContentLogic() throws ClassNotFoundException {
          ProxyFactoryBean factory = new ProxyFactoryBean();
          factory.setInterceptorNames(new String[]{"cacheAdvisor"});
          factory.setTargetClass(ContentLogicImpl.class);
          factory.setProxyInterfaces(new Class[]{ContentLogic.class});
          return (ContentLogic) factory.getObject();
      }
  }
  </code></pre>