Skip to content
Advertisement

Create RESTful web service for current logged user in Spring Boot

I have URL for user dashboard(/users/{userId}).

I wanted to support /users/current for current logged user, and I searched for ways to implement that, and I did that by the following code.

However, I think it’s too overwhelming and I wonder if there are better/simpler ways to do that.

JavaScript
JavaScript
JavaScript

P. S. I think I made a much better solution with custom annotation (@UserPath)

JavaScript

Advertisement

Answer

maybe custom annotation with AbstractNamedValueMethodArgumentResolver would be the best solution. Read P.S of the question for more details.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement