若是前台接收的数据为null的不进行传递

1.在实体类上添加注解

@JsonInclude(JsonInclude.Include.NON_NULL)

2.在yml中进行配置全局

spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    username: root
    password: 123456
    url: jdbc:mysql://192.168.30.113/sell?characterEncoding=utf-8&useSSL=false
  jpa:
    show-sql: true
  jackson:
    default-property-inclusion: non_null
  redis:
    host: 192.168.30.113
    port: 6379
server:
  context-path: /sell
原文地址:https://www.cnblogs.com/gxlaqj/p/11660867.html