Yeast infection

I just got yeast infection but I’m not sure how. I did have sex with my boyfriend Saturday but he doesn’t have it... is there another way I can get it? What are the ways you can get it ?