@Autowired on a constructor of a Scala class

scala, spring

Solution

I haven't tried it, but according to this and this link, from 2.8+ you could do:

class MessageMBeanExporter @Autowired() (messageDirectory: MessageDirectory) extends MBeanExporter with SmartLifecycle {
      .....
}

Problem

I have a simple question, How could I use spring @Autowired on a constructor of this Scala class? ``` class MessageMBeanExporter(messageDirectory: MessageDirectory) extends MBeanExporter with SmartLifecycle { ..... } ```

Original source