Germany has struggled to cope with the impact of the Russian invasion of Ukraine, which sent prices for energy and food soaring.