Spring Data Rest Jpa 插入@Lob 字段 [英] Spring Data Rest Jpa insert @Lob field

查看:66
本文介绍了Spring Data Rest Jpa 插入@Lob 字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 spring 数据休息服务,它公开了一个资源,如:

I have a spring data rest service, that expose a resource like:

@Entity
public class Resource{
    private String name;
    @Lob
    private byte[] data;

    private String contentType;
}

json 应该如何插入这种类型的资源?

How should be a json to insert a resource of this type?

推荐答案

AFAIK,SDR 还不能处理多部分请求或响应,因为它只能处理 JSON.

AFAIK, SDR does not handle multipart requests or responses yet, as it can only do JSON.

您可以在运行常规 Spring MVC servlet 的同时运行 SDR(这是您配置中的一行代码).

You can run SDR at the same time as a regular Spring MVC servlet (it's one line of code in your config).

我建议您使用常规 Spring MVC 控制器进行文件上传/下载,其余使用 SDR(双关语).

I would suggest using a regular Spring MVC controller for your file upload/download, and SDR for the rest (pun intended).

这篇关于Spring Data Rest Jpa 插入@Lob 字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆