I know that by default, the JAX-RS endpoint life cycle is once per request , so you can enter information specific to the request into the instance.
And we can also make Singleton endpoints, which means once for an application in which the request information cannot be entered into the instance, but can be entered into the requested method.
1. So, I would like to know which approach is better in terms of performance, once per request or once for each application .
2. I would also like to know all the pros and cons of these approaches, other data requiring injection,
3. Which approach do you prefer to use in your applications API
Note. I have used the method "once in a single request" so far, but I am always surprised that it is efficient, definitely simplify it and reuse it.
source
share