Spring Boot – List all Beans loaded in the ApplicationContext

Last Updated on

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.

Karl San Gabriel

Karl San Gabriel

Professional Software Developer