A spray bottle would work.
For biting cats I'll let them bite for a few days and make noise when they do it. "oowwwwww", even though it doesn't really hurt. Most cats will accept that you don't like to be bitten that hard, and begin to scale back the pressure they use while still biting.
Some of it is bonding, the cats really really wants to play and let you know that we're friends now. And as such will tend to get less over time as the cat gets more secure. Some of it is reinforcing. When they bite push their mouth off the bitten area and scratch an ear. Do that often enough and they seem to realize that the bite is too hard, but you're not angry with them.
I had one tomcat bite me to the bone. That one actually hurt and I picked him up so his face was level with mine, looked him straight in the eye, and yelled "Oww!" at him. Weirdly, that tomcat never bit again and would follow me around like his alpha. I think he was impressed that I didn't kill him. Of course, I had another cat who was just so affectionate she never did stop biting until she got old... then she seemed to realize that she was playing too rough. Couldn't teach her shit. She was sweet younger, a natural hunter. Just a prickly pear.
The door is a wonderful invention. There are rooms that my cats are not allowed to go into without me present. It takes them a little while to understand that's the rule, but once it sinks in it works. I can even leave the doors open and they'll sit at the threshold and ask if they can come in.