title: How to bootstrap Spring Data KeyValue?
body: <p><a href="http://docs.spring.io/spring-data/keyvalue/docs/current/reference/html/" rel="nofollow">Spring Data KeyValue</a> looks great for quickly knocking up a mock microservice. How can I bootstrap it with data?</p>
  
  <p>I tried adding stuff to the <code>KeyValueAdapter</code>, but by specifying the bean myself, I've ended up with <code>Repository</code>s that have been wired with a <em>different</em> <code>KeyValueAdapter</code>, and so don't have the data available. </p>
  
  <pre><code>@Configuration
  @EnableMapRepositories
  public class PersistenceConfig
  {
      @Bean
      public KeyValueAdapter keyValueAdapter() {
          KeyValueAdapter adapter = new MapKeyValueAdapter(ConcurrentHashMap.class);
          Account testAccount = new Account();
          testAccount.id = "dj-asc-test";
          testAccount.givenName = "Gertrude";
          adapter.put(testAccount.id, testAccount, "accounts");
          Account read = (Account) adapter.get("dj-asc-test", "accounts");
          Assert.notNull(read);
          return adapter;
      }
  }
  </code></pre>