Austria attacked in 1805; Prussia declared war in 1806. The Russians joined both. 1807 was a continuation of 1806 against the Russians. 1809 the Austrians attacked.
Both in 1805 and 1809 the Austrians attacked without a declaration of war.
Those wars were defensive.
Russia was a preemptive strike as Alexander began planning for war against France in 1810.
Spain was occupied because Napoleon found out that the Spanish were planning to turn on him if he lost in Prussia.