Right- he is 2.5, the impulse control is not there and it is your responsibility to keep him safe by installing another kind of lock or whatever. You hitting him might "work" in a Pavlovian way (I open the door and I get hit. That hurts, so I won't open the door... probably), but it is not only a painful and damaging way to learn, it is not really effective in the long run (when does it end?). You can manage a lot of childrens behaviors by working on fear and pain, but it doesn't help them grow, it doesn't help your relationship, and it doesn't work in the long run.
If something is dangerous for our children, it is OUR job to make their environment safe. At some point, they learn these dangers and then we pass on that responsibility to them as they learn about them. It is a natural process. At 2.5, I had the house on virtual lock-down. No small toys for the mouth, slips on the door knobs, locks on the cabinets... Now ds1 is 4. He knows the danger of going outside without me and so we took the baby lock off the door, for example. He has toys with little tiny pieces. Your son WILL understand the dangers as he gets older, and so for now making his environment safe is YOUR job, not his.
And yes, many toddlers have strong wills. But think about it: Do you really want your position in life to be your will dominating his? You talk proudly of your own strong will (which I also think can be a very good thing). I would think the goal is to work with him in encouraging personal strength, not to crush it. It can be frustrating, but really effective and positive discipline is about learning the lesson at the right time, not about following orders.
Stepping back from our parents and deciding to parent differently can be very hard on both the adult child and her parents. The parent can feel that their child is saying they did not do a good job raising them, the adult child can feel like "well, I turned out OK but something still bothers me about this and the idea that it was wrong is upsetting because now I have to rethink this whole thing".
"A swat on the butt" is still hitting to hurt and using that fear and pain to control. There are other ways.