Is there a way to print all the spring beans that are loaded on startup?I am using Spring 2.0.
Using spring-boot-starter-actuator you can easily access all bean.
Here is the setup process:
Add bellow into gradle file:
compile("org.springframework.boot:spring-boot-starter-actuator")
Add management.security.enabled=false into your application.property file
call /beans endpoint:
After that setup spring will enable some metrics related endpoints. One of its endpoint is /beans After calling this endpoints it will provide a json file that contains all of your bean including it's dependency and scope.
Here is an example json file:
[{"context":"application:8442","parent":null,"beans":[{"bean":"beanName","aliases":[],"scope":"singleton","type":"packageName$$4b46c703","resource":"null","dependencies":["environment","beanName1","beanName2"]},{"bean":"org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory","aliases":[],"scope":"singleton","type":"org.springframework.core.type.classreading.CachingMetadataReaderFactory","resource":"null","dependencies":[]}]
For more info visit bellow links:
Hope this will help you. Thanks :)