Q:

Complex annotation in Scala

In order to create a message driven bean in Scala, using JBoss, I need to annotate the class as follows:
@MessageDriven(
        activationConfig=Array(@ActivationConfigProperty(propertyName="destination", propertyValue="java:/queue/mail") ),
        messageListenerInterface=classOf[MessageListener])
class MailService extends MessageListener {    
    def onMessage(m: Message) {
        ...
    }   
}

The trouble comes in that the annotation contains an attribute which itself is an annotation, and the Scala compiler doesn't seem to be able to cope with it.
The error message is: "illegal start of simple expression", highlighted around the @ symbol on the second line, just after "activationConfig".
In Java I'd write the annotation as follows:
@MessageDriven(
        activationConfig={@ActivationConfigProperty(propertyName="destination", propertyValue="java:/queue/mail")}, 
        messageListenerInterface=MessageListener.class)

Is there a way in Scala to write the annotation, so that this works?
Is there any way to trick the compiler to generate the byte code in the way I want to?
Thanks,
John

A:

try this
@MessageDriven(
  activationConfig = Array[ActivationConfigProperty](
    new ActivationConfigProperty(propertyName = "desctination", propertyValue = "java:/queue/mail")),
  messageListenerInterface = classOf[MessageListener]
)
class MailService extends MessageListener {
  def onMessage(m: Message) {
  //...
  }
}

