Glassfish/Wildfly not failing if @Resource cannot be resolved?

Viewed 70

I am experimenting with @Resource in a servlet to see if we can use it to inject configuration parameters easily (this is servlet 3.0 webapp in Glassfish 4.1.1).

I was told in https://stackoverflow.com/a/45715196/53897 that the behavior I saw of a @Resource String userName being null when used if it could not be resolved if the env-entries in web.xml were not present, to be wrong according to the specification, but that the behavior of WildFly was the same.

Question is: Is this a known bug? Is there a flag that can enforce the "fail if not resolvable"?

1 Answers
Related