Impossible as you have. This can be done using AOP methods. But,
@EJB(mappedName = "java:module/" + MyService.class.getSimpleName()) private MyService myService;
In this piece of code you have only one possible value, namely "MyService". It will not change dynamically, so why do you want to evaluate it dynamically?
source share