title: REST POST to Java app returns JSON response with some fields null
body: <p>I am entering a JSON POST using Postman to localhost where I have a Springboot app running.</p>
  
  <p><strong>The POST is:</strong></p>
  
  <pre><code>{"applicantName":"On Gaber","amount":"5000","asset":"Car","creditScore":"602"}
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>@RestController
  public class LoanSubmissionController {
  private LoanService loanService;
  @Autowired
  public LoanSubmissionController(LoanService loanService) {
      this.loanService = loanService;
  }
  
  @RequestMapping(method = RequestMethod.POST)
  @ResponseStatus(HttpStatus.CREATED)
  LoanApplicationDTO create(
          @RequestBody @Valid LoanApplicationDTO loanApplicationDTO) {
      return loanService.create(loanApplicationDTO);
  
  }
  </code></pre>
  
  <p><strong>Service Class:</strong></p>
  
  <pre><code>@Service
  public class LoanSubmissionService implements LoanService {
  
  @Autowired
  private final LoanApplicationRepository repository;
  
  @Autowired
  public LoanSubmissionService(LoanApplicationRepository repository) {
      this.repository = repository;
  }
  
  // @Override
  public LoanApplicationDTO create(LoanApplicationDTO loanApplicationDTO) {
      LoanApplication persisted = LoanApplication.getBuilder()
              .applicantName(loanApplicationDTO.getApplicantName())
              .amount(loanApplicationDTO.getAmount()).build();
      persisted = repository.save(persisted);
      return convertToDTO(persisted);
  }
  </code></pre>
  
  <p><strong>Repository Class:</strong></p>
  
  <pre><code>public interface LoanApplicationRepository extends
      MongoRepository&lt;LoanApplication, String&gt; {
  
  @SuppressWarnings("unchecked")
  LoanApplication save(LoanApplication saved);
  </code></pre>
  
  <p><strong>DTO Class:</strong></p>
  
  <pre><code>package com.liquidlogic.loanprocessor.web;
  
  public final class LoanApplicationDTO {
  
  private String id;
  private String applicantName;
  private String amount;
  private String asset;
  private String creditScore;
  
  public LoanApplicationDTO() {
  }
  
  public String getId() {
      return id;
  }
  
  public void setId(String id) {
      this.id = id;
  }
  
  public String getApplicantName() {
      return applicantName;
  }
  
  public void setApplicantName(String applicantName) {
      this.applicantName = applicantName;
  }
  
  public String getAmount() {
      return amount;
  }
  
  public void setAmount(String amount) {
      this.amount = amount;
  }
  
  public String getAsset() {
      return asset;
  }
  
  public void setAsset(String asset) {
      this.asset = asset;
  }
  
  public String getCreditScore() {
      return creditScore;
  }
  
  public void setCreditScore(String creditScore) {
      this.creditScore = creditScore;
  }
  
  }
  </code></pre>
  
  <p><strong>Domain Class:</strong></p>
  
  <pre><code>import org.springframework.data.annotation.Id;
  import org.springframework.util.Assert;
  
  public class LoanApplication implements Application {
  
  @Id
  private String id;
  private String applicantName;
  private String amount;
  private String asset;
  private String creditScore;
  
  public LoanApplication() {
  }
  
  private LoanApplication(ApplicationBuilder builder) {
      Assert.notNull(builder);
      this.applicantName = builder.applicantName;
      this.amount = builder.amount;
      this.asset = builder.asset;
      this.creditScore = builder.creditScore;
  }
  
  public static ApplicationBuilder getBuilder() {
      return new ApplicationBuilder();
  }
  
  public String getId() {
      return id;
  }
  
  public void setId(String id) {
      this.id = id;
  }
  
  public String getAmount() {
      return amount;
  }
  
  public void setAmount(String amount) {
      this.amount = amount;
  }
  
  public String getAsset() {
      return asset;
  }
  
  public void setAsset(String asset) {
      this.asset = asset;
  }
  
  public String getCreditScore() {
      return creditScore;
  }
  
  public void setCreditScore(String creditScore) {
      this.creditScore = creditScore;
  }
  
  public void setApplicantName(String applicantName) {
      this.applicantName = applicantName;
  }
  
  public String getApplicantName() {
      return applicantName;
  }
  
  @Override
  public String toString() {
      return "LoanApplication [id=" + id + ", applicantName=" + applicantName
              + ", amount=" + amount + ", asset=" + asset + ", creditScore="
              + creditScore + "]";
  }
  
  public void update(String applicantName, String amount, String asset,
          String creditScore) {
      this.applicantName = applicantName;
      this.amount = amount;
      this.asset = asset;
      this.creditScore = creditScore;
  }
  
  public static class ApplicationBuilder {
  
      private String applicantName;
      private String amount;
      private String asset;
      private String creditScore;
  
      private ApplicationBuilder() {
      }
  
      public ApplicationBuilder applicantName(String applicantName) {
          this.applicantName = applicantName;
          return this;
      }
  
      public ApplicationBuilder amount(String amount) {
          this.amount = amount;
          return this;
      }
  
      public ApplicationBuilder asset(String asset) {
          this.asset = asset;
          return this;
      }
  
      public ApplicationBuilder creditScore(String creditScore) {
          this.creditScore = creditScore;
          return this;
      }
  
      public LoanApplication build() {
          LoanApplication build = new LoanApplication(this);
          return build;
      }
  
  }
  
  }
  </code></pre>
  
  <p>Springboot autowires up and configures the entire app.  There's no need for a web.xml or Spring configuration, Springboot does it all.  </p>
  
  <p><strong>application.properties:</strong></p>
  
  <pre><code>logging.level.org.springframework.web=DEBUG
  spring.data.mongodb.host=localhost
  spring.data.mongodb.port=27017
  </code></pre>
  
  <p><strong>JSON Response:</strong></p>
  
  <pre><code>{
    "id": "55c39c23f04a07251bc598b0",
    "applicantName": "On Gaber",
    "amount": "5000",
    "asset": null,
    "creditScore": null
  }
  </code></pre>
  
  <p>Abbreviated Eclipse Console output:</p>
  
  <pre><code>: Started LoanApplicationProcessor in 5.258 seconds (JVM running for 6.012)
  : Successfully completed request
  </code></pre>
  
  <p>All fields in the domain and DTO are type String.  I can't figure out why the "asset" and "credtiScore" fields are null.  Any ideas?</p>