Hi all,
I have a small doubt regarding "Injection of Simple Environment Entries Using Annotations".
If i have the code as shown below
@Stateless public class EmployeeServiceBean
implements EmployeeService
{
...
// The maximum number of tax exemptions, configured by Deployer
@Resource int maxExemptions;
// The minimum number of tax exemptions, configured by Deployer
@Resource int minExemptions;
public void setTaxInfo(int numberOfExemptions,...) throws InvalidNumberOfExemptionsException {
...
// Use the environment entries to customize business logic.
if (numberOfExemptions > maxExemptions ||numberOfExemptions < minExemptions)
throw new InvalidNumberOfExemptionsException();
}
}
How can i specify the values of the simple Environment entries maxExemptions and minExemptions?
Can anybody show me the dd snippet of it. Also can't we specify the value directly in the bean code as follows
@Resource int maxExemptions = 4;
The spec says
To support this case, the container must only inject a value for the environment entry if the application
assembler or deployer has specified a value to override the default value.
Can anybody explain the above statement. Does this mean that we should always specify <env-entry-value> in the dd even after we have given a default value in @Resource int maxExemptions = 4;. But that doesn't make sense.
Thank you all in advance.
With Regards
Deepthi