  We propose a systematic way of finding solutions to classical Yang-Mills
equation with nontrivial topology. This approach is based on one of Wightman
axioms for quantum field theory, which is referred to as form invariance
condition in this paper. For a given gauge group and a spacetime with certain
isometries, thanks to this axiom that imposes strong constraints on the general
Ansatz, a systematic way of solving Yang-Mills equation can be obtained in both
flat and curved spacetimes. In order to demonstrate this method, we recover
various known solutions as special cases as well as produce new solutions not
previously reported in the literature.
