title: How to declare a respository populator bean using java config instead of XML?
body: <p>I am working on a Spring based project that is (so-far) completely XML-free, except now I've hit a wall with the Spring JPA repository populator:</p>
  
  <pre><code>&lt;repository:jackson-populator location="classpath:data.json" /&gt;
  </code></pre>
  
  <p>How would the above be expressed in a java @Configuration class?</p>
  
  <p>This post suggests using the FactoryBean directly:
  <a href="https://stackoverflow.com/a/13566712/1746274">https://stackoverflow.com/a/13566712/1746274</a></p>
  
  <p>I tried that and the closest I got was the following but it's not quite right. </p>
  
  <pre><code>@Bean(name="repositoryPopulator")
  public RepositoryPopulator getRespositoryPopulator() throws Exception {
      final JacksonRepositoryPopulatorFactoryBean factory =  new JacksonRepositoryPopulatorFactoryBean();
      factory.getObject().setResourceLocation("classpath:test-data.json");
      factory.afterPropertiesSet();
      return factory.getObject();
  }
  </code></pre>
  
  <p>The above results in a <code>FactoryBeanNotInitializedException</code> with the message <code>JacksonRepositoryPopulatorFactoryBean does not support circular references</code>.</p>
  
  <p>Any ideas?</p>