若是前台接收的数据为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

 

posted @ 2019-10-12 12:47  我爱si搬砖  阅读(406)  评论(0编辑  收藏  举报