Print all beans loaded by Spring Boot

In this post, we will see how to print all the beans loaded by Spring boot.

We have already created a sample spring boot hello world program using JSP. You must be wondering what beans have been loaded by Spring in background.

Change SpringBootHelloWorldApplication.java as below:

You just need to implement CommandLineRunner and get ApplicatationContext object using @Autowire annotation.

basicErrorController
beanNameHandlerMapping
beanNameViewResolver
characterEncodingFilter
conventionErrorViewResolver
defaultServletHandlerMapping
defaultValidator
defaultViewResolver
dispatcherServlet
dispatcherServletRegistration
duplicateServerPropertiesDetector
embeddedServletContainerCustomizerBeanPostProcessor
error
errorAttributes
errorPageCustomizer
errorPageRegistrarBeanPostProcessor
faviconHandlerMapping
faviconRequestHandler
handlerExceptionResolver
helloWorldController
hiddenHttpMethodFilter
httpPutFormContentFilter
httpRequestHandlerAdapter
jacksonObjectMapper
jacksonObjectMapperBuilder
jsonComponentModule
localeCharsetMappingsCustomizer
mappingJackson2HttpMessageConverter

That’s all about how to print all the beans loaded by Spring boot

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *