开发者

Annotations args dynamic

Every Devlopers Nightmare is how well does his/her code fit into the final packaging....

problem with EJB3.x is usage of annotations with out being able to re compile the code with fresh set of args for the unit to pass thru integration test

ex:

@MessageDriven(activationConfig = {
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        @Activation开发者_运维技巧ConfigProperty(propertyName = "destination", propertyValue = "queue/Messagess") })

Question is How many J2ee Containers guarantee the queue jms box is always "queue/Messagess"

Well the naming can be "queue/xyzabc" .....

How can such arguments be configured in EJB3.x with out recompiling the code ...???

with regards

karthik


Use activation-config-property in XML.

<message-driven>
  <ejb-name>YourMDBName</ejb-name>
  <activation-config>
    <activation-config-property>
      <activation-config-property-name>destination</activation-config-property-name>
      <activation-config-property-value>YourValue</activation-config-property-value>
    </activation-config-property>
  </activation-config>
</message-driven>

Just because you use EJB 3.x with annotations for ease-of-development does not mean that using XML to override annotation config data is "wrong".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜