title: Spring Boot - Source must not be null
body: <p>I created a simple Spring Boot app with one endpoint that creates a new record in a <code>users</code> table.</p>
  
  <p>However, when i hit this endpoint with Postman, i'm getting the following error:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Source must not be null
      at org.springframework.util.Assert.notNull(Assert.java:198) ~[spring-core-5.2.1.RELEASE.jar:5.2.1.RELEASE]
      at org.springframework.beans.BeanUtils.copyProperties(BeanUtils.java:693) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
      at org.springframework.beans.BeanUtils.copyProperties(BeanUtils.java:639) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
      at com.demo.controller.UserController.createUser(UserController.java:45) ~[classes/:na]
  </code></pre>
  
  <p>What is the issue?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Apparently it does save the record in the DB, but returns an error still.
  Here's the code for <code>UserController</code>:</p>
  
  <pre><code>    @PostMapping
      public UserRest createUser(@RequestBody UserDetailsRequestModel userDetails) 
      {
  
          UserRest result = new UserRest();
          UserDto userDto = new UserDto();
  
          BeanUtils.copyProperties(userDetails, userDto);
  
          UserDto createdUser = userService.createUser(userDto);
  
          BeanUtils.copyProperties(createdUser, result);
          return result;
      }
  </code></pre>