Wouldn't a RuntimException with a message that "something" must be present be enough? As long as the app isn't silently accepting that there is a missing value and starts in an unknown state?
I'm not proposing, recommending or denigrating anything. Scott had asked how a Java class file is supposed to advertise a programmatic JNDI lookup in the Jakarta EE world. The type-level @Resource annotation is how that is supposed to work.