Method permissions interact with one another as a union!
Method permissions do not relate to one another in the same way that transaction attributes do. With transaction attributes, using a wildcard says, “Every method in this bean will have this attribute unless I say otherwise, by naming a specific method in a different container-transaction tag.” In other words, naming a specific method overrides the wildcard setting.
But with method permissions, using the wildcard says, “All methods in this bean can be accessed by this role.” Nothing else you do in any other method permission will change that.
Transaction attributes
<container-transaction> <method> <ejb-name>BigBean</ejb-name> <method-name> * </method-name> </method> <trans-attribute>RequiresNew</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>BigBean</ejb-name> <method-name>useOldDatabase</method-name> </method> <trans-attribute>NotSupported</trans-attribute> </container-transaction>
This says that all methods in BigBean will use the RequiresNew attribute, EXCEPT the useOldDatabase method, which will use the NotSupported attribute.
The second <container-transaction> overrides the wildcard one, and takes the useOldDatabase method out of the RequiresNew list and moves it to the NotSupported list.
Method permissions
<method-permission> <role-name>Minion</role-name> <method> <ejb-name>WorldDomination</ejb-name> <method-name>*</method-name> </method> </method-permission> <method-permission> <role-name>Boss</role-name> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access