diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml
index 691137e495..2a1de00039 100644
--- a/spring-boot/pom.xml
+++ b/spring-boot/pom.xml
@@ -45,7 +45,13 @@
spring-boot-starter-tomcat
provided
-
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
org.apache.tomcat.embed
tomcat-embed-core
diff --git a/spring-boot/src/main/java/com/baeldung/displayallbeans/Application.java b/spring-boot/src/main/java/com/baeldung/displayallbeans/Application.java
new file mode 100644
index 0000000000..fcce2725e5
--- /dev/null
+++ b/spring-boot/src/main/java/com/baeldung/displayallbeans/Application.java
@@ -0,0 +1,19 @@
+package com.baeldung.displayallbeans;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.ApplicationContext;
+
+@SpringBootApplication
+public class Application {
+ private static ApplicationContext applicationContext;
+
+ public static void main(String[] args) {
+ applicationContext = SpringApplication.run(Application.class, args);
+
+ String[] allBeanNames = applicationContext.getBeanDefinitionNames();
+ for(String beanName : allBeanNames) {
+ System.out.println(beanName);
+ }
+ }
+}
diff --git a/spring-boot/src/main/java/com/baeldung/displayallbeans/SpringConfig.java b/spring-boot/src/main/java/com/baeldung/displayallbeans/SpringConfig.java
new file mode 100644
index 0000000000..1d4a97f843
--- /dev/null
+++ b/spring-boot/src/main/java/com/baeldung/displayallbeans/SpringConfig.java
@@ -0,0 +1,19 @@
+package com.baeldung.displayallbeans;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+
+import com.baeldung.displayallbeans.model.Person;
+
+@Configuration
+@ComponentScan(basePackages = "com.baeldung.displayallbeans")
+public class SpringConfig {
+ @Bean
+ public Person person() {
+ Person person = new Person();
+ person.setName("Jon Doe");
+ return person;
+ }
+}
\ No newline at end of file
diff --git a/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/PersonController.java b/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/PersonController.java
new file mode 100644
index 0000000000..93fc278b1c
--- /dev/null
+++ b/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/PersonController.java
@@ -0,0 +1,19 @@
+package com.baeldung.displayallbeans.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.baeldung.displayallbeans.model.Person;
+
+@Controller
+public class PersonController {
+ @Autowired
+ Person person;
+
+ @RequestMapping("/getPerson")
+ public @ResponseBody Person getPerson() {
+ return person;
+ }
+}
\ No newline at end of file
diff --git a/spring-boot/src/main/java/com/baeldung/displayallbeans/model/Person.java b/spring-boot/src/main/java/com/baeldung/displayallbeans/model/Person.java
new file mode 100644
index 0000000000..dde471aedb
--- /dev/null
+++ b/spring-boot/src/main/java/com/baeldung/displayallbeans/model/Person.java
@@ -0,0 +1,13 @@
+package com.baeldung.displayallbeans.model;
+
+public class Person {
+ String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
\ No newline at end of file
diff --git a/spring-boot/src/main/resources/application.properties b/spring-boot/src/main/resources/application.properties
index 444f68d50a..458b4e0d46 100644
--- a/spring-boot/src/main/resources/application.properties
+++ b/spring-boot/src/main/resources/application.properties
@@ -45,4 +45,7 @@ servlet.mapping=/dispatcherExampleURL
#banner.image.margin= //TODO
#banner.image.invert= //TODO
-contactInfoType=email
\ No newline at end of file
+contactInfoType=email
+
+endpoints.beans.id=springbeans
+endpoints.beans.sensitive=false
diff --git a/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java
new file mode 100644
index 0000000000..84d5669aef
--- /dev/null
+++ b/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java
@@ -0,0 +1,84 @@
+package com.baeldung.displayallbeans;
+
+import static org.assertj.core.api.BDDAssertions.then;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.web.context.WebApplicationContext;
+
+import com.baeldung.displayallbeans.Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@TestPropertySource(properties = {"management.port=0", "endpoints.beans.id=springbeans", "endpoints.beans.sensitive=false"})
+public class DisplayBeanIntegrationTest {
+
+ @LocalServerPort
+ private int port;
+
+ @Value("${local.management.port}")
+ private int mgt;
+
+ @Autowired
+ private TestRestTemplate testRestTemplate;
+
+ @Autowired
+ private WebApplicationContext context;
+
+ @Test
+ public void givenRestTemplate_whenAccessServerUrl_thenHttpStatusOK() throws Exception {
+ @SuppressWarnings("rawtypes")
+ ResponseEntity