title: how to use @Valid with update for springboot
body: <p>this Person.java  it has valid</p>
  
  <pre><code>@Entity
  @Data
  @DynamicUpdate
  public class Person {
  
      @Id
      @GeneratedValue
      private Integer id;
  
      @NotNull(message = "姓名必填字段")
      private String name;
      @NotNull(message = "地址必填字段")
      private String address;
  </code></pre>
  
  <p>Controller.java it use valid </p>
  
  <pre><code>    @PostMapping("/person")
  public Result&lt;Person&gt; personAdd(@Valid Person person, BindingResult bindingResult) {
      if (bindingResult.hasErrors()) {
          return ResultUtil.error(1, bindingResult.getFieldError().getDefaultMessage());
      }
      return ResultUtil.success(personService.save(person));
  }
  
      @PutMapping("/person/2")
      public Result personAdd2(@RequestBody Person person) throws PersonException {
  //        Person resultPerson = personService.findOne(person.getId());
  //        BeanUtils.copyProperties(resultPerson,person);
          return ResultUtil.success(personService.save(person));
  
      }
  </code></pre>
  
  <p>Test.java it's error</p>
  
  <pre><code> @Test
  public void testPersonAdd2() throws Exception{
      Person person = new Person();
      person.setId(2);
      person.setName("marry");
      String responseString = mvc.perform(put("/person/2")
              .content(asJsonString(person))
              .contentType(MediaType.APPLICATION_JSON)
              .accept(MediaType.APPLICATION_JSON))
              .andExpect(status().isOk())
              .andDo(print())
              .andReturn().getResponse().getContentAsString();
      log.info(responseString);
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>ConstraintViolationImpl{interpolatedMessage='地址必填字段', propertyPath=address, rootBeanClass=class cn.merryyou.logback.domain.Person, messageTemplate='地址必填字段'}
  </code></pre>
  
  <p>I need when save valid but update is not valid. what should I do</p>
  
  <p>the code: <a href="https://github.com/longfeizheng/logback" rel="nofollow noreferrer">logback</a>
  my English is pool </p>