- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Spring Data KeyValue看起来非常适合快速构建模拟微服务。如何用数据引导它?
我尝试向 KeyValueAdapter
添加内容,但通过自己指定 bean,我最终得到的 Repository
已使用不同的连接 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;
}
}
最佳答案
我猜您更愿意使用存储库,因为适配器基本上已就位以插入其他 Map
实现。假设您有一个像这样的 PersonRepository
:
interface PersonRepository extends CrudRepository<Person, Long> { … }
那么这应该可以工作:
@Configuration
@EnableMapRepositories
class Application {
@Autowired PersonRepository repository;
@PostConstruct
public void init() {
repository.save(new Person(…));
}
}
关于java - 如何引导 Spring Data KeyValue?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35298379/
我正在使用 Spark Streaming 下载网页并插入到 Hbase 中。我遇到以下异常: WARN scheduler.TaskSetManager: Lost task 13.1 in sta
KeyValue start = new KeyValue(enemy.translateXProperty(), 0); KeyValue end = new KeyValue(enemy.tran
我今天在这里试图找出如何做到这一点。我有下面的代码来查看 DataRow 中的每一列,但如何访问键和值?我想将它分配给类中的字典,但我似乎无法同时获取它们,我获取任何内容的唯一方法是调用: var c
我正在用简单的代码测试 Angular 的 keyvalue 管道: import { Component } from '@angular/core'; @Component({ selecto
我有一个关于文件系统使用的基本问题 我想使用一个非常面向写入的嵌入式 KeyValue 存储。 (持久)说我的值(value)大小是 a) 10K b) 1M 并且读取和更新数量相等 我不能简单地创建
我正在尝试使用 Java 签署 XML 文档,并且我正在遵循此 tutorial 。我试图使用我的私钥签署文档,但是当我查看 API 时,它说 KeyValue只接受一个 PublicKey 作为参数
我很难弄清楚为什么 persons 数组包含新的 age 键值对。 我想通过切片(并因此创建一个独立的副本)我可以只在 newArray 上工作并且只将 age 附加到它......但它似乎正在更新
我正在查看此处的表格 View 单元格,并找到以下代码: - (void)awakeFromNib { [super awakeFromNib]; [self addObserver:
我正在尝试实现键值观察模式,并且在大多数情况下该过程运行良好,但我的 newValue 和 oldValue 是相同的,即使值已从旧值更改为新值。这是我到目前为止所实现的示例代码。如果有人能告诉我哪里
我是 iCloud 存储的新手,在构建我的下一个应用程序之前,我想听听一些关于什么会更好的意见。 此应用程序需要存储许多包含字符串数组的 NSDictionaries,仅此而已。将有 365 个字典(
尝试使用键值对从 iCloud 检索一个整数。有人可以向我解释为什么这会因错误而崩溃: '[ valueForUndefinedKey:]: this class is not key value
我创建的应用程序在开发服务器 ng serve 上运行良好,但是当我尝试为生产构建时,它因此错误而失败 ERROR in src/app/leaderboard/leaderboard.compone
Spring Data KeyValue看起来非常适合快速构建模拟微服务。如何用数据引导它? 我尝试向 KeyValueAdapter 添加内容,但通过自己指定 bean,我最终得到的 Reposit
我已经添加了 hbase.client.keyvalue.maxsize 0 在 hbase-site.xml 中。 我从 hbase-0.94.27/docs/hba
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 1 年前。
我想使用Lodash基于key:value合并两个对象,这里我需要比较itemId和id,如果这两个值相等我想将 price 和 itemId 添加到列表中。下面我展示了一个小示例以及预期的输出: i
and so on ... 场景: - 上面给出的是我正在使用的 Telerik RagGrid 控件的标记。我尝试以通常的方式访问 GridColumn 的 KeyValue
在按键事件中我们可以使用KeyChar 属性,在KeyDown 事件中我们可以使用KeyValue。我需要在 KeyPress 事件中使用 KeyValue 和 KeyChar 属性。我该怎么做? 最
最近在学习Phoenix CSV Bulk Load,发现org.apache.phoenix.mapreduce.CsvToKeyValueReducer的源码在列比较大的时候会导致OOM(java
我在文件中有一个键值。如何将此值转换为表示此键的字符串? 当我有事件时: void text_KeyDown(Object sender, KeyEventArgs e) {
我是一名优秀的程序员,十分优秀!