#How Spring beans lifecycle works for request
1 messages · Page 1 of 1 (latest)
<@&1004656351647117403> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
That doesn't sound thread safe
Unless you're doing some locking
Could you explain your scenario a bit more?
I would like to read the Authorization header of the request to identify the logged user
My idea is to have a "UserService" which have a "getCurrentUser()" who identity the user depending if the header
With a Bearer token or an API key as example
Wouldn't it make more sense to make the UserService request scoped
But if only the UserService is request scoped, how to know which instance will be passed for instancing other service
If a have, as example, a MessageService, which need the UserService to know who is sending message, how should I do ?
Or putting every service in request scoped mode is the best solution ?
Either that or make the methods you call accept an object from which you can deduce the user (or the User itself even)
Alright :(
And what is the purpose of the proxyMode for request scopped beans ?