title: Spring boot + thymeleaf in IntelliJ: cannot resolve vars
body: <p>I'm writing a short web form application using spring boot and thymeleaf on IntelliJ, but it seems that in the html file, all fields in the model cannot be resolved. Here is my code:</p>
  
  <p>Controller class:</p>
  
  <pre><code>@Controller
  public class IndexController{
  
      @RequestMapping(value = "/", method = RequestMethod.GET)
      public String index(){
          return "index";
      }
  
      @RequestMapping(value="/", method = RequestMethod.POST)
      public String addNewPost(@Valid Post post, BindingResult bindingResult, Model model){
          if(bindingResult.hasErrors()){
              return "index";
          }
          model.addAttribute("title",post.getTitle());
          model.addAttribute("content",post.getContent());
          return "hello";
      }
  }
  </code></pre>
  
  <p>Model Class:</p>
  
  <pre><code>public class Post {
  
      @Size(min=4, max=35)
      private String title;
  
      @Size(min=30, max=1000)
      private String content;
  
      public String getTitle() {
          return title;
      }
  
      public void setTitle(String title) {
          this.title = title;
      }
  
      public String getContent() {
          return content;
      }
  
      public void setContent(String content) {
          this.content = content;
      }
  }
  </code></pre>
  
  <p>Then is the index.html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;head lang="en"&gt;
  
      &lt;title&gt;Spring Framework Leo&lt;/title&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;h3&gt;Spring Boot and Thymeleaf&lt;/h3&gt;
  
  
      &lt;form action="#" th:action="@{/}"  th:object="${post}" method="post"&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;Title:&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" th:field="*{title}" /&gt;&lt;/td&gt;
                  &lt;td th:if="${#fields.hasErrors('title')}" th:errors="*{title}"&gt;Title error message&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;Content:&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" th:field="*{content}" /&gt;&lt;/td&gt;
                  &lt;td th:if="${#fields.hasErrors('content')}" th:errors="*{content}"&gt;Content error message&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;button type="submit"&gt;Submit post&lt;/button&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>There are always red lines under "post", "title"  and "content", but I don't know how to solve it. Is it a problem of IntelliJ or just a problem of my code?</p>