Yes.... there was an acceleration in WWII (classes were graduated in 3 years to get Ensigns to the Fleet). That actually continued a few years after the War (I think '47). That was a different time ...we had several years to ramp up the force structure to fight a global war. Chances of that happening again are unlikely in today's society. The next major war is likely to be short and violent, and fought with whatever assets are on hand at the time. That's why training and readiness are so important now .
With respect to how wars affect number of applications, I would expect that it depends largely on the public's perception of the war. For example, during Vietnam and the period following, the military and Service Academies weren't particularly in favor, and I would suspect applications were down. In contrast, there was an increase of applications post 9-11.
The current events, regardless of how they turn out, really don't affect 2024 applicants at all. USNA will be using the same selection criteria they have for years. In my opinion, nothing is really changed ... we have been fighting Iran's terrorist proxies for years. It's not like they have been holding anything back trying to kill American service members, but we have been hamstrung trying to play whack-a -mole against ill defined targets. Now we finally got one, Iran has to react to save face, but they know they don't want to trigger a full blown war against the US. That didn't end well for Japan in 1945, and didn't end well for Al Quaeda in 2001. We've shown that the US military can be pretty effective when we have a clearly defined target. My expectation is that Iran is going to continue its little game of whack a mole, and try to exploit divisions in the country until the American people have had enough.