Germany and Japan accelerate military buildup as threats reshape defense spending