Spring Data KeyValue看起来非常适合快速构建模拟微服务。如何使用数据引导它?
我尝试向 中添加东西KeyValueAdapter
,但是通过自己指定 bean,我最终得到了s 与不同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;
}
}