It was thought that ulcers were caused by stress or by eating spicy food. But we now know that isn’t the case. If you have an ulcer, it may be best to avoid certain foods temporarily while it heals.