public static String getUserIdFromSecurityContext() {
		final SecurityContext context = SecurityContextHolder.getContext();
		if (context != null) {
			final Authentication authentication = context.getAuthentication();
			if (authentication != null) {
				return authentication.getPrincipal().toString();
			}
		}
		return null;
	}
public static String getUserIdFromSecurityContext() {
		final SecurityContext context = SecurityContextHolder.getContext();
		if (context != null) {
			final Authentication authentication = context.getAuthentication();
			if (authentication != null) {
				return authentication.getPrincipal().toString();
			}
		}
		return null;
	}
public static String getUserIdFromSecurityContext ( ) { final SecurityContext context = SecurityContextHolder . getContext ( ) ; if ( context != null ) { final Authentication authentication = context . getAuthentication ( ) ; if ( authentication != null ) { return authentication . getPrincipal ( ) . toString ( ) ; } } return null ; }
Gets the user id from security context.

@return the user id from security context
Gets the user id from security context .