title: org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 8): Property or field
body: <p>I am writing a sample code using spring boot ,jpa with Thymeleaf. Here is my code, i could see the data coming till Controller but unable to display due to below exception. Your help is highly appreciated. </p>
  
  <pre><code>Controller:
  
  @Controller
  @RequestMapping("/account")
  public class AccountController {
  
      @Autowired
      AccountRepository accountRepository;
  
      @RequestMapping("/")
      public String list(ModelMap modelMap){
          List&lt;Account&gt; accounts = (List&lt;Account&gt;) accountRepository.findAll();
          modelMap.put("accounts", accounts);
          //return accountRepository.findAll();
          return "account";
      }
  
  Entity:
  
  @Entity
  public class Account {
  
      @Id
      @GeneratedValue
      private Integer accountId;
  
      private String name;
  
      private String accType;
  
      public Integer getAccountId() {
          return accountId;
      }
  
      public String getName() {
          return name;
      }
  
      public String getAccType() {
          return accType;
      }
  
      public Account(Integer accountId, String name, String accType) {
          super();
          this.accountId = accountId;
          this.name = name;
          this.accType = accType;
      }
  
  account.html
  
  &lt;!DOCTYPE html&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;head&gt;
  &lt;meta charset="ISO-8859-1"/&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt; Account Management&lt;/h1&gt;
      &lt;table border="2"&gt;
          &lt;tr&gt;
              &lt;th&gt;Account Id&lt;/th&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Account Type&lt;/th&gt;
          &lt;/tr&gt;
  
          &lt;tr th:each="account : accounts"&gt;
              &lt;td th:text="${account.accountId}"/&gt;
              &lt;td th:text="${account.name}"/&gt;
              &lt;td th:text="${account.accType}"/&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;a href="/"&gt;Back&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  
  Exception Stack trace:
  
  2016-10-12 14:51:56.263 ERROR 32572 --- [nio-8080-exec-1] org.thymeleaf.TemplateEngine             : [THYMELEAF][http-nio-8080-exec-1] Exception processing template "account": Exception evaluating SpringEL expression: "account.accountId" (account:17)
  2016-10-12 14:51:56.269 ERROR 32572 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "account.accountId" (account:17)] with root cause
  
  org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 8): Property or field 'accountId' cannot be found on object of type 'java.lang.String' - maybe not public?
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:224) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:94) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.access$000(PropertyOrFieldReference.java:46) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:374) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:120) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:267) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.thymeleaf.spring4.expression.SpelVariableExpressionEvaluator.evaluate(SpelVariableExpressionEvaluator.java:139) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.standard.expression.VariableExpression.executeVariable(VariableExpression.java:154) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:59) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.standard.expression.Expression.execute(Expression.java:103) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.standard.expression.Expression.execute(Expression.java:133) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.standard.expression.Expression.execute(Expression.java:120) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.standard.processor.attr.AbstractStandardTextChildModifierAttrProcessor.getText(AbstractStandardTextChildModifierAttrProcessor.java:68) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.processor.attr.AbstractTextChildModifierAttrProcessor.getModifiedChildren(AbstractTextChildModifierAttrProcessor.java:59) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.processor.attr.AbstractChildrenModifierAttrProcessor.processAttribute(AbstractChildrenModifierAttrProcessor.java:59) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.processor.attr.AbstractAttrProcessor.doProcess(AbstractAttrProcessor.java:87) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.processor.AbstractProcessor.process(AbstractProcessor.java:212) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.dom.Node.applyNextProcessor(Node.java:1017) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  </code></pre>