title: Property or field 'name' cannot be found on object of type 'java.util.Optional' - maybe not public or not valid?
body: <p>I want to show Room Detail when I click name of room.. But I have a problem I don't know why. I using Spring MVC,Spring Boot,Spring Data and Thymeleaf</p>
  
  <pre><code>org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'name' cannot be found on object of type 'java.util.Optional' - maybe not public or not valid?
  </code></pre>
  
  <p>I think the problem is about Optional in Service when I use Spring Data findById()
  This is my code</p>
  
  <p>Room Model</p>
  
  <pre><code>@Entity
  @Table(name ="room")
  public class Room implements Serializable {
   private static final long serialVersionUID = 1L;
   @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      @Column(name = "ID_room", nullable = false)
      private String id;
  
  
      @Column(name = "name_room", nullable = false)
      private String name;
  
  
      @Column(name = "Description")
      private String describe;
  
      @Column(name = "ID_status")
      private String status;
  
      @Column(name = "room_image")
      private String image;
  
      public Room() {
          super();
      }
  
      public Room(String id, String name, String describe, String status,String image) {
          super();
          this.id = id;
          this.name = name;
          this.describe = describe;
          this.status = status;
          this.image = image;
  
      }
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getDescribe() {
          return describe;
      }
  
      public void setDescribe(String describe) {
          this.describe = describe;
      }
  
      public String getStatus() {
          return status;
      }
  
      public void setStatus(String status) {
          this.status = status;
      }
  
      public String getImage() {
          return image;
      }
  
      public void setImage(String image) {
          this.image = image;
      }
  
  
  }
  </code></pre>
  
  <p>Room Service</p>
  
  <pre><code>public interface RoomService {
  
  
  Optional&lt;Room&gt; findOne(String id);
  
  
  }
  </code></pre>
  
  <p>Room Service Implement</p>
  
  <pre><code>public class RoomServiceImpl implements RoomService {
  @Autowired
  private RoomRepository roomRepository;
  
  @Override
  public Optional&lt;Room&gt; findOne(String id) {
  
      return roomRepository.findById(id);
  }
  
  }
  </code></pre>
  
  <p>RomController</p>
  
  <pre><code>@GetMapping("/room/{id}/detail")
  public String detail(@PathVariable String id, Model model) {
      model.addAttribute("room", romService.findOne(id));
      return "roomDetail";
  }
  </code></pre>
  
  <p>roomDetail.html</p>
  
  <pre><code>&lt;div class="col-md-7 single-top-in"&gt;
                      &lt;div class="single-para"&gt;
                          &lt;h4&gt;&lt;tr th:text="${room.name}"&gt;&lt;/h4&gt;
                          &lt;div class="para-grid"&gt;
                              &lt;span  class="add-to"&gt;$32.8&lt;/span&gt;
                              &lt;a href="#" class="hvr-shutter-in-vertical cart-to"&gt;Add to Cart&lt;/a&gt;                 
                              &lt;div class="clearfix"&gt;&lt;/div&gt;
                           &lt;/div&gt;
                          &lt;h5&gt;100 items in stock&lt;/h5&gt;
  
                          &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.&lt;/p&gt;
  </code></pre>