What your boyfriend said was extremely invalidating. He may as well have said "Now that we know your headaches are caused by migraines, you have no excuse to get them anymore."
Having a diagnosis is certainly helpful. The more information you have the better equipped you are. However, it's niave to think you're going to turn around over night. It simply doesn't work that way. This isn't some day time TV show where the main character is cured once his therapist helps him realize what his problem really is.
If anything, it's more fair to say you have no excuse to seek therapy and work on self-improvement.
I don't think your boyfriend meant to be insensitive. I think he, like a lot of people, is simply uninformed. It's hard for a lot of people to wrap their heads around mental illness and to think of it as such. Hopefully he'll be willing to educate himself and better understand the reality of what you're trying to deal with.