Do wars really advance technology? Or does technology advances and then is (ab)used at wars?

I wouldn’t say wars themselves advance technology, but war and the threat of war do force cultures to adopt their enemy’s technology. Arguably one goal of world capitalism is to replace the violent dispersion of technology through war, with free trade.