Spring Data KeyValueは、モック マイクロサービスをすばやくノックアップするのに最適です。データでブートストラップするにはどうすればよいですか?
に何かを追加しようとしましたKeyValueAdapter
が、自分で Bean を指定すると、別Repository
の に接続された s になってしまい、データを利用できません。 KeyValueAdapter
@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;
}
}