0

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;
    }
}
4

1 に答える 1