Now make it with user-configurable credentials (like extracted from database) with proper token caching.
With similar code I almost made a vulnerability in my app because Spring cached tokens which belong to different users.
Spring security is terrible piece of code. Spring - I can stand it. Spring Security - I can not. It was different project back in the day (Acegi Security if I remember correctly). It should have stayed that way.