Boyfriend realizes he’s gay

My boyfriend of two years was acting really weird and was ignoring me for the last week. He finally told me why and turns out he realized he’s gay over the last year. I totally understand that it can be hard to figure yourself and your sexuality out at our age. And we agreed to stay friends. It makes sense because our relationship did feel very much like best friends with benefits. But it kind of hurts.

Has anyone else had something like this happen to them?