Here is a snippet of restAPI-related code in question:

An interface method in Controller:

    @RequestMapping(value = "/employees")
    public ResponseEntity<EmployeeListVO> getAllEmployees()throws CloneNotSupportedException{
        EmployeeListVO employeeListVO;
        employeeListVO=(EmployeeListVO)EmployeeDB.getEmployeeList().clone();
        return new ResponseEntity<>(employeeListVO,HttpStatus.OK);
    }
Copy the code

EmployeeListVO.class:

public class EmployeeListVO implements Serializable,Cloneable {
    List<EmployeeVO>employees
            = new ArrayList<>();
    List<EmployeeVO>getEmployees() {return employees;
    }
    public void setEmployees(List<EmployeeVO>employees){ this.employees = employees; }}Copy the code

The problem code appears in employeelistvo.class:

The reason I suspect is that since the getter method for employees is not public, springBoot cannot find it when it returns an object and therefore its value is naturally null; I did not study the new source code, if you know the big guy also hope to give advice.

The attached:

Public – accessible everywhere

Protected — accessible in the same package and in sub-classes

Default – accessible only in the same package

Private – accessible only in the same class