title: Spring Boot 1.4 MVC testing with Thymeleaf results in TemplateProcessingException
body: <p>I'm trying to test a Spring Boot 1.4.0.M3 MVC slice. The controller is this.</p>
  
  <pre><code>@Controller
  public class ProductController {
  
  private ProductService productService;
  
  @Autowired
  public void setProductService(ProductService productService) {
      this.productService = productService;
   }
  
   @RequestMapping("product/{id}")
   public String showProduct(@PathVariable Integer id, Model model){
      model.addAttribute("product", productService.getProductById(id));
      return "productshow";
   }
  }
  </code></pre>
  
  <p>The minimized view of the <code>productshow.html</code> thymeleaf template is this.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;body&gt;
   &lt;div class="container"&gt;  
    &lt;h2&gt;Product Details&lt;/h2&gt;
      &lt;div&gt;
          &lt;form class="form-horizontal"&gt;
              &lt;div class="form-group"&gt;
                  &lt;label class="col-sm-2 control-label"&gt;Product Id:&lt;/label&gt;
                  &lt;div class="col-sm-10"&gt;
                      &lt;p class="form-control-static" th:text="${product.id}"&gt;Product Id&lt;/p&gt;&lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label class="col-sm-2 control-label"&gt;Description:&lt;/label&gt;
                  &lt;div class="col-sm-10"&gt;
                      &lt;p class="form-control-static" th:text="${product.description}"&gt;description&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;                
          &lt;/form&gt;
     &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And the test class is this.</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @WebMvcTest(controllers = ProductController.class, secure = false)
  //@AutoConfigureMockMvc(secure=false)
  public class ProductControllerTest {
      @Autowired
      private MockMvc mockMvc;
      @MockBean
      private ProductService productServiceMock;
  
  @Test
  public void testShowProduct() throws Exception {
     Product product1 = new Product();
     product1.setId(1);
     product1.setDescription("T Shirt");
     product1.setPrice(new BigDecimal("18.95"));
     product1.setImageUrl("https://example.com/wp-content/uploads/2015/04/spring_framework_guru_shirt-rf412049699c14ba5b68bb1c09182bfa2_8nax2_512.jpg");
     when(productServiceMock.getProductById(1)).thenReturn(product1);
  
     MvcResult result = mockMvc.perform(get("/product/{id}/", 1))
             .andExpect(status().isOk())              
             .andReturn();
   }
  }
  </code></pre>
  
  <p>On running the test, I get the following error.</p>
  
  <pre><code>2016-07-03 00:03:29.021 ERROR 6800 --- [           main]  
  org.thymeleaf.TemplateEngine             : [THYMELEAF][main] Exception  
  processing template "productshow": Exception evaluating SpringEL 
  expression: "product.id" (productshow:19)
  
  org.springframework.web.util.NestedServletException: Request processing  
  failed; nested exception is 
  org.thymeleaf.exceptions.TemplateProcessingException: Exception 
  evaluating SpringEL expression: "product.id" (productshow:19)
  </code></pre>
  
  <p>Need help to resolve this. Thanks in advance.</p>