title: HttpMediaTypeNotSupportedException
body: <p>I have this class in my <em>.NET</em> application to send some data from client(.NET) to server(Spring) :</p>
  
  <pre><code>    class NetworkController
      {
          private static readonly HttpClient client = new HttpClient();
          public static async Task SendUserDataAsync()
          {
              var values = new Dictionary&lt;string, string&gt;
              {
                  { "firstName", "sunny" },
                  { "lastName", "leone" },
                  { "timeStamp", "test" }
              };
              var content = new FormUrlEncodedContent(values);
              var response = await client.PostAsync("http://localhost:8080/user", content);
              var responseString = await response.Content.ReadAsStringAsync();
  
          }
      }
  </code></pre>
  
  <p><a href="https://stackoverflow.com/a/4015346/10305444">Reference</a></p>
  
  <p>And in my Spring Boot application, I a class called <code>User</code> :</p>
  
  <pre><code>@Entity
  public class User
  {
      @Id
      private String firstName;
      private String lastName;
      private String timeStamp;
      public User(){}
      @Override
      public String toString() {
          return "firstName : "+this.firstName + "\n"+"lastName : " + this.lastName;
      }
  }
  </code></pre>
  
  <p>In my <em>rest-controller</em> I have this method to insert <code>User</code> :</p>
  
  <pre><code>@PostMapping("/user")
      User addUser(@RequestBody User user)
      {
          System.out.println(user);//this always prints an empty line, maybe receiving nothing
          return userRepository.save(user);
      }
  </code></pre>
  
  <p>I get this warning <strong>Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported]</strong></p>
  
  <p>I have created this class(with the concept of Spring) in .NET, but it seems no use :</p>
  
  <pre><code>class User
      {
          String firstName;
          String lastName;
          String timeStamp;
  
          public User()
          {
              firstName = "1"
              lastName = "2"
              timeStamp = "test"
          }
  
      }
  </code></pre>
  
  <p>Wouldn't sending an object instead of dictionary be more gentle and tidy ? How to do so ?</p>
  
  <p>How can I resolve this problem ?</p>