Beans

The beans endpoint provides the details about the beans that are loaded into the Spring context. This is useful in debugging any problems related to Spring context.

An extract from the response of the /application/beans endpoint is shown below:

  {
"bean": "basicController",
"aliases": [],
"scope": "singleton",
"type": "com.mastering.spring.springboot.
controller.BasicController",
"resource": "file [/in28Minutes/Workspaces/
SpringTutorial/mastering-spring-chapter-5-6-
7/target/classes/com/mastering/spring/springboot/
controller/BasicController.class]",
"dependencies": [
"messageSource"
]
},
{
"bean": "todoController",
"aliases": [],
"scope": "singleton",
"type": "com.mastering.spring.springboot.
controller.TodoController",
"resource": "file [/in28Minutes/Workspaces/SpringTutorial/
mastering-spring-chapter-5-6-
7/target/classes/com/mastering/spring/
springboot/controller/TodoController.class]",
"dependencies": [
"todoService"
]
}

It shows the details for two beans: basicController and todoController. You can see the ;following details for all the beans:

  • The name of the bean and its aliases
  • The scope of the bean
  • The type of the bean
  • The exact location of the class from which this bean is created
  • Dependencies of the bean
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset