Together our study highlights a beneficial role for inflammation in the development of CD4+ T cell-mediated immunity and identifies IMs as a potential target for enhancing T cell immunity to intracellular bacterial infection. Here, CD4 is linked to bacterial infectious disease.