Ernst August II., Braunschweig-Lüneburg, Herzog