When did the Mexican Spanish War end?

Mexico was granted Independence.