【发布时间】:2020-12-25 12:46:44
【问题描述】:
我必须在运行时呈现我选择的数据格式。
例如
public class Message {
@Id
private String version;
private String title;
private String content;
private String sender;
private String url;
}
现在如果我点击 url http://localhost:8080/messages/12345/xml 它应该返回 xml 格式 如果我点击 url http://localhost:8080/messages/12345/json 那么我应该返回 json 格式
但终点应该相同 http://localhost:8080/messages/12345
我对 Spring boot 和 REST 非常陌生,这将是一个很大的帮助。
【问题讨论】:
标签: spring-boot rest spring-data-jpa