These results indicate that in mastitis, GPR109A promotes autophagy and Nrf2 nuclear import through AMPK, thereby inhibiting inflammatory damage to the mammary gland and repairing the blood milk barrier. This evidence concerns the gene HCAR2 and mastitis.