title: Spring Jackson Serialization of Scala Enumeration
body: <p>I'm trying to get spring though jackson to serialize my scala enum.  From what i've been able to tell I need to follow this: <a href="https://github.com/FasterXML/jackson-module-scala/wiki/Enumerations" rel="nofollow noreferrer">https://github.com/FasterXML/jackson-module-scala/wiki/Enumerations</a></p>
  
  <p>I'm useing Scala Version 2.12.6 and Spring Boot Version 2.0.3</p>
  
  <p>My Enum looks like:</p>
  
  <pre><code>object MyEnum extends Enumeration {
      type MyEnum = Value
      val VALUE_1 = Value("Value 1")
      val VALUE_2 = Value("Value 2")
  }
  
  class MyEnumTypeReference extends TypeReference[MyEnum.type]
  </code></pre>
  
  <p>My Entity looks like:</p>
  
  <pre><code>@Entity
  @Table(name = "TABLE", schema = "schema")
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  class MyEntity(var myId: String, var someOtherThing: String, @JsonScalaEnumeration(classOf[MyEnumTypeReference]) var myEnum: MyEnum.MyEnum) extends Serializable {
      def this() = this(null, null, null)
      def this(myId: String, myEnum: MyEnum.MyEnum) = this(myId, myEnum)
  
      // Getters and Setters
  }
  </code></pre>
  
  <p>When I hit my spring endpoint that queries this entity I get:</p>
  
  <pre><code>[
      {
          "myId": "123456",
          "someOtherThing": "I'm a String",
          "myEnum": {}
      }
  ]
  </code></pre>
  
  <p>I've verified that the entity returned though my ReponseEntity in my controller contains a value for the enum.  I can't figure out why the enum just has an empty object instead of the serialized object?  Thanks in advance.</p>
  
  <p>Edit:  I've also tested it directly using the objectmapper that I set in my spring configuration and it serializes the enum correctly there.  I also tried autowiring springs objectmapper in my controller and it serializes correctly there too.</p>