title: Thymeleaf spring boot jpa can't get data fom the dabase, no error detected
body: <p>I'm working on a project using Spring Boot and I'm trying to integrate Thymeleaf to get information from the database. It's the first time I use Thymeleaf.</p>
  
  <p>Here my entity class:</p>
  
  <pre><code>package com.org.model;
  
  import java.io.Serializable;
  import javax.persistence.*;
  
  import com.fasterxml.jackson.annotation.JsonIgnore;
  import com.fasterxml.jackson.annotation.JsonManagedReference;
  
  import java.math.BigDecimal;
  import java.util.List;
  
  
  /**
   * The persistent class for the countries database table.
   * 
   */
  @Entity
  @Table(name="countries")
  //@NamedQuery(name="Country.findAll", query="SELECT c FROM Country c")
  
  public class Country implements Serializable {
      private static final long serialVersionUID = 1L;
  
      @Id
      @Column(name="COUNTRY_ID")
      private String countryId;
  
      @Column(name="COUNTRY_NAME")
      private String countryName;
  
      //bi-directional many-to-one association to Region
  
      @ManyToOne
      @JoinColumn(name="REGION_ID")
      private Region region;
  
      //bi-directional many-to-one association to Location
      @JsonIgnore
      @OneToMany(mappedBy="country")
      private List&lt;Location&gt; locations;
  
      public Country() {
      }
  
      public String getCountryId() {
          return this.countryId;
      }
  
      public void setCountryId(String countryId) {
          this.countryId = countryId;
      }
  
      public String getCountryName() {
          return this.countryName;
      }
  
      public void setCountryName(String countryName) {
          this.countryName = countryName;
      }
  
      public Region getRegion() {
          return this.region;
      }
  
      public void setRegion(Region region) {
          this.region = region;
      }
  
      public List&lt;Location&gt; getLocations() {
          return this.locations;
      }
  
      public void setLocations(List&lt;Location&gt; locations) {
          this.locations = locations;
      }
  
      public Location addLocation(Location location) {
          getLocations().add(location);
          location.setCountry(this);
  
          return location;
      }
  
      public Location removeLocation(Location location) {
          getLocations().remove(location);
          location.setCountry(null);
  
          return location;
      }
  
  }
  </code></pre>
  
  <p>here is my controller:</p>
  
  <pre><code>package com.org.controller;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.ResponseBody;
  import org.springframework.web.bind.annotation.RestController;
  
  import com.org.model.Country;
  import com.org.repository.CountryRepository;
  
      @Controller    // This means that this class is a Controller
  @RequestMapping(path="/api", produces=MediaType.APPLICATION_JSON_VALUE) // This means that this class is a Controller
  
  public class CountryController {
          @Autowired // This means to get the bean called userRepository
          // Which is auto-generated by Spring, we will use it to handle the data
      private CountryRepository countryRepository;
  
  
  
          @RequestMapping(value="/country", method= RequestMethod.GET)
          public String list(Model model){
              model.addAttribute("Country", countryRepository.findAll());
  
  
              // This returns a JSON or XML with the users
              return "countries";
          }
  
  
      //  @RequestMapping(path="/country/{countryId}")
      //    public @ResponseBody Country getCountry(@PathVariable String countryId) {
      //        return countryRepository.findOne(countryId);
      //    }
      }
  </code></pre>
  
  <p>I create a HTML file to display the data in a table:</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
      &lt;html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security"&gt;
      &lt;head lang="en"&gt;
  
      &lt;/head&gt;
      &lt;body&gt;
      &lt;div class="container"&gt;
          &lt;!--/*/ &lt;th:block th:include="fragments/header :: header"&gt;&lt;/th:block&gt; /*/--&gt;
  
      &lt;div th:if="${not #lists.isEmpty(countries)}"&gt;
  
              &lt;table class="table table-striped"&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Country Id&lt;/th&gt;
                      &lt;th&gt;Country Name&lt;/th&gt;
                      &lt;th&gt;Region Id&lt;/th&gt;
                      &lt;th&gt;Location&lt;/th&gt;
  
                  &lt;/tr&gt;
                  &lt;tr th:ForEach="Country : ${countries}"&gt;
                      &lt;td th:text="${Country.countryId}"&gt;id country&lt;/td&gt;
                      &lt;td th:text="${Country.countryName}"&gt;Country Name&lt;/td&gt;
                      &lt;td th:text="${Country.region}"&gt;Region Id&lt;/td&gt;
                      &lt;td th:text="${Country.locations}"&gt;Location&lt;/td&gt;
  
                  &lt;/tr&gt;
              &lt;/table&gt;
  
          &lt;/div&gt;
  
      &lt;/div&gt;
  
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>I added the Thymleaf dependency to the <code>pom.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;xxxx.org&lt;/groupId&gt;
      &lt;artifactId&gt;project&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;name&gt;webService&lt;/name&gt;
      &lt;description&gt;first project for university&lt;/description&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.5.7.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-rest&lt;/artifactId&gt;
          &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;io.springfox&lt;/groupId&gt;
      &lt;artifactId&gt;springfox-swagger2&lt;/artifactId&gt;
      &lt;version&gt;2.6.1&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;io.springfox&lt;/groupId&gt;
      &lt;artifactId&gt;springfox-swagger-ui&lt;/artifactId&gt;
      &lt;version&gt;2.6.1&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
  &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
    &lt;groupId&gt;org.modelmapper&lt;/groupId&gt;
    &lt;artifactId&gt;modelmapper&lt;/artifactId&gt;
    &lt;version&gt;1.1.0&lt;/version&gt;
  &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.thymeleaf&lt;/groupId&gt;
              &lt;artifactId&gt;thymeleaf-spring4&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I got no error but white screen no error in the console:</p>
  
  <p><img src="https://i.stack.imgur.com/OlhuT.png" alt="enter image description here"></p>