Preheat your oven to 400°F. Place the whole garlic cloves on a piece of aluminum foil, drizzle with a little olive oil, and wrap them tightly. Roast in the oven for about 30 minutes, until soft and fragrant.
In a large pot, heat the olive oil over medium heat. Add the diced onion, carrots, and celery. Sauté for about 5-7 minutes, until the vegetables are softened.
Add the drained white beans, vegetable broth, and dried rosemary to the pot. Bring to a boil, then reduce the heat and let it simmer for 15 minutes.
Once the garlic is roasted, squeeze the soft garlic out of the skins and add it to the soup. Use an immersion blender to puree the soup until smooth, or carefully transfer it to a blender in batches.
Stir in the lemon juice and season with salt and pepper to taste. If the soup is too thick, add a little more broth or water to reach your desired consistency.
Serve hot, garnished with fresh rosemary sprigs if desired.