How to get User ID from CustomUser on Spring Security
Authentication authentication = ...
CustomUser customUser = (CustomUser)authentication.getPrincipal();
int userId = customUser.getUserId();
You have to add the getUserId()
getter method if you don't already have it.