1. 创建入参实体:
package com.hsm.ls.application.test.domain;
/**
* Created by lfx on 2018/12/19.
*/
public class ActiveRequest {
private String sid;
private String biz;
private String text;
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
public String getBiz() {
return biz;
}
public void setBiz(String biz) {
this.biz = biz;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public String toString() {
return "ActiveRequest{" +
"sid='" + sid + '\'' +
", biz='" + biz + '\'' +
", text='" + text + '\'' +
'}';
}
}
2. 编写controller层
@RestController
@RequestMapping("/nlp")
public class SemanticsController {
@RequestMapping(value = "/active", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public String active(@RequestBody ActiveRequest request) {
System.out.println(request.toString());
return "active";
}
}
3. 测试