问题描述
我需要在我的一个 Spring Cloud 函数中生成对象列表。
public class Mysupplier {
@Bean
public supplier<List<LineItem>> produce() {
return () -> {
return asList(
LineItem.builder()
.username("a-user")
.password("test")
.build(),LineItem.builder()
.username("b-user")
.password("secure")
.build()
);
};
}
}
但是,当我放置一个需要单个 LineItem
的消费函数时,我收到一个错误:
Cannot deserialize instance of ce.eo.LineItem out of START_ARRAY token at [Source: (byte[])
这个错误的原因很明显:Mysupplier.produce()
生成的列表被序列化为一个列表,而不是多个单独的对象。但是,我仍然希望能够单独处理这些对象。
有没有办法在 Spring Cloud Function 中解决这个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)