Spring Boot解决向前端返回对象时的属性无序问题

问题:

实体类属性

Spring Boot解决向前端返回对象时的属性无序问题

现在返回EmployeeMatrix对象到前端,属性顺序乱了,通过Postman测试的结果如下所示,

Spring Boot解决向前端返回对象时的属性无序问题

解决方法:

添加@JsonPropertyOrder注解

Spring Boot解决向前端返回对象时的属性无序问题

再次使用Postman测试,如下如所示

Spring Boot解决向前端返回对象时的属性无序问题