I broke up with my boyfriend

I broke up with my boyfriend of almost four years a few days ago, and I’m questioning whether I did the right thing. (Sorry this is gonna be long) In a few months I’m leaving for basic training, and I told him I didn’t want to live where we live now forever, and when I finish basic and Ait I hope to be stationed either overseas or a different state. he doesn’t want to come with me, he said he would rather stay here with his family. I was willing to work it out, and so was he, but his ideal thought of “working it out” is being engaged/married and me still living in one area and him in another. He never wants to move to be where I am, and doesn’t even want to consider the thought of it. I never asked him to come with me but I felt kind of hurt about this because I have given up a lot for him in the past, but to his defense he never asked me too. I just thought relationships were about compromise. He started being petty and bringing up old things, and just being really selfish and obnoxious after this. Saying I threw four years away, etc. Fast forward a few days, he’s now asking that I don’t go into the army at all, he’s asking me to give it up and stay here with him. After this I just ended things, I felt like he was way to co-dependent on me and that it was maybe better to distance myself from him because he didn’t want me to do what I want, and he started acting out of character. I miss him and we’ve been through so much the last 4 years. He started acting so weird & I don’t know if it was my fault or what. Did I make the wrong choice?