jsr366-experts@javaee-spec.java.net

[jsr366-experts] Re: default resources

From: Bill Shannon <bill.shannon_at_oracle.com>
Date: Mon, 17 Nov 2014 16:49:38 -0800

Let me describe another issue that has been raised in this area...

If I have an application:

        @Resource(name="MyFactory", type=javax.jms.ConnectionFactory.class)
        ConnectionFactory cf;

with a deployment descriptor intended to supply the mapping for the resource:

        <resource-ref>
            <res-ref-name>MyFactroy</res-ref-name>
            <res-type>javax.jms.ConnectionFactory</res-type>
            <mapped-name>JMS1</mapped-name>
        </resource-ref>

Note that we now have two resource references, one mapped to the
default JMS connection factory and used by the application, and
one mapped to the JMS connection factory named "JMS1" and not used
by the application. A typo or misspelling might result in unintended
mappings.

Option D doesn't help with this at all.

Option B would allow for a product-specific option that disables the
default mapping behavior, allowing deployment of the above application
to fail.

Is this a reason to consider Option B, perhaps in addition to Option D?