title: No serializer found for class using Json
body: <p>I have a basic SpringBoot 2.1.2.RELEASE app. Using Spring Initializer, JPA, embedded Tomcat, Thymeleaf template engine, and package as an executable JAR with a restful architecture</p>
  
  <p>I have this object that I return in a RestMethod:</p>
  
  <pre><code>public class MenuAlarm {
  
  
  
      /**
       * 
       */
      public MenuAlarm() {
          super();
      }
  
  
      /**
       * 
       */
      public MenuAlarm(Menu menu) {
  
          this.menuAlias = menu.getName();
          this.menuId = menu.getId();
  
          menu
              .getAlerts()
              .forEach(a -&gt; alarms.add(new Alarm(a)));
  
      }
  
      class Alarm {
  
          public Alarm(MenuAlert menuAlert) {
  
              this.percentage = menuAlert.getPercentage();
  
              if (menuAlert.getCriteria() &gt; 1) {
                  this.increase = true;
              } else {
                  this.increase = false;
              }
              this.enabled = menuAlert.isEnabled();
          }
  
          public Alarm() {
              super();
          }
  
          Integer percentage;
  
          boolean increase;
  
          boolean enabled;
  
      }
  
      String menuAlias;
  
      Long menuId;
  
      List&lt;Alarm&gt; alarms = new ArrayList&lt;Alarm&gt;();
  
      public String getMenuAlias() {
          return menuAlias;
      }
  
      public void setMenuAlias(String menuAlias) {
          this.menuAlias = menuAlias;
      }
  
      public Long getMenuId() {
          return MenuId;
      }
  
      public void setMenuId(Long menuId) {
          this.menuId = menuId;
      }
  
      public List&lt;Alarm&gt; getAlarms() {
          return alarms;
      }
  
      public void setAlarms(List&lt;Alarm&gt; alarms) {
          this.alarms = alarms;
      }
  }
  </code></pre>
  
  <p>but when I return the result I got this error:</p>
  
  <pre><code>Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class com.tdk.api.json.MenuAlarm$Alarm and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.tdk.api.json.UserAlerts[“menuAlarms"]-&gt;java.util.ArrayList[0]-&gt;com.tdk.api.json.MenuAlarm["alarms"]-&gt;java.util.ArrayList[0])`
  </code></pre>