My good friend who has published seven novels and STILL deals with professional rejection (after all, publishing success can have a jagged trajetory), always reminded me as I kept bashing my head against what seemed like the impenetrable publishing wall: The last woman standing wins the publishing contract.
And many writer friends I know remind each other of the TPT rule: talent, persistence and timing is what it takes. Probably the most important factor there is persistence, because you can be the best writer out there, but if you're not willing to tuck your head down and plunge forward, linebackers be damned, you're gonna have a hard time getting anywhere in this business.
Hang in there and believe in yourself and your ability. There will be plenty of times along the way that you will be the ONLY one who believes in you. But it's that faith that'll keep you going. With every rejection I received, I reminded myself of how many editors scoffed at JK Rowling's manuscript, Harry Potter and the Sorcerer's Stone. Hang tight, continue to write, and tough it out. If it's meant to be, it'll happen.