注释args动态

时间:2011-06-26 17:22:48

标签: java testing ejb-3.0 integration-testing

每个Devlopers Nightmare都是他/她的代码在最终包装中的适应性....

EJB3.x的问题是使用注释而无法使用新的args集重新编译代码以使单元通过集成测试

前:

@MessageDriven(activationConfig = {
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/Messagess") })

问题是有多少J2ee容器保证队列jms框始终是“queue / Messagess”

好的命名可以是“queue / xyzabc”.....

如何在EJB3.x中配置这些参数而不重新编译代码...... ???

关于

KARTHIK

1 个答案:

答案 0 :(得分:0)

在XML中使用activation-config-property。

<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>

仅仅因为您使用带有注释的EJB 3.x来简化开发并不意味着使用XML来覆盖注释配置数据是“错误的”。