0

Spring Boot – List all Beans loaded in the ApplicationContext

With Spring Boot, a lot of beans get loaded into the ApplicationContext depending on your dependencies selection. This post shows a code snippet used to list all the beans loaded in the ApplicationContext.

Your Typical Main Class

Consider the following code snippet. You can use IntelliJ (optional) and Spring Initialzr (https://start.spring.io) to generate the initial codes and pom.xml.

Get and used ApplicationContext

Modify the original codes to these. Notice the lines 10-16.