использую spring security и boot, отправляю данные при помощи постмана, данные не доходят 401 ошибка.
POST /registration HTTP/1.1
Host: localhost:8080
Accept: application/json
Content-Type: application/json
User-Agent: PostmanRuntime/7.20.1
Cache-Control: no-cache
Postman-Token: 2f772401-e251-4456-9d61-6b61e97c4926,c4af2ad0-0a7b-4f44-a380-
127fad39f644
Host: localhost:8080
Accept-Encoding: gzip, deflate
Content-Length: 59
Cookie: JSESSIONID=0867EA3A4911C082EC22931BE2020BD8
Connection: keep-alive
cache-control: no-cache
{"empNo":"E11","empName":"New Employee","position":"Clerk"}
Сам контроллер.
@RequestMapping(value = "/employee", //
method = RequestMethod.POST, //
produces = { MediaType.APPLICATION_JSON_VALUE, //
MediaType.APPLICATION_XML_VALUE })
@ResponseBody
public Employee addEmployee(@RequestBody Employee emp) {
System.out.println("(Service Side) Creating employee: " + emp.getEmpNo());
return emp;
}
package com.example.labksp;
Класс
public class Employee {
private String empNo;
private String empName;
private String position;
public Employee() {
}
public Employee(String empNo, String empName, String position) {
this.empNo = empNo;
this.empName = empName;
this.position = position;
}
public String getEmpNo() {
return empNo;
}
public void setEmpNo(String empNo) {
this.empNo = empNo;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
}
Мучаюсь вторую неделю, можете помочь?