Giants beat Dodgers 4-1 in spring game