locations = Arrays.asList(classPathResource);
+ requestHandler.setLocations(locations);
+ return requestHandler;
+ }
+
+ // @Controller
+ static class FaviconController {
+
+ @RequestMapping(value = "favicon.ico", method = RequestMethod.GET)
+ @ResponseBody
+ void favicon() {
+ }
+ }
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/META-INF/spring.factories b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000000..336477df96
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,2 @@
+org.springframework.boot.diagnostics.FailureAnalyzer=com.baeldung.failureanalyzer.MyBeanNotOfRequiredTypeFailureAnalyzer
+
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/application-errorhandling.properties b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/application-errorhandling.properties
new file mode 100644
index 0000000000..0a6d68763c
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/application-errorhandling.properties
@@ -0,0 +1,10 @@
+#server
+server.port=9000
+spring.mvc.servlet.path=/
+server.servlet.context-path=/
+server.error.whitelabel.enabled=false
+
+#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration
+
+#for Spring Boot 2.0+
+#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/application.properties b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/application.properties
new file mode 100644
index 0000000000..4d4a6ec7bd
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/application.properties
@@ -0,0 +1,7 @@
+#spring.banner.charset=UTF-8
+#spring.banner.location=classpath:banner.txt
+#spring.banner.image.location=classpath:banner.gif
+#spring.banner.image.width= //TODO
+#spring.banner.image.height= //TODO
+#spring.banner.image.margin= //TODO
+#spring.banner.image.invert= //TODO
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/banner.txt b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/banner.txt
new file mode 100644
index 0000000000..abfa666eb6
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/banner.txt
@@ -0,0 +1,14 @@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@#@@@@@########@@@@@@@@@@@@@@@@@@@@@@@@...@@@@@@@@@:..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@#. @@@@@* *@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@#o @@@@@* @@@@@* @@@:*.*@@@@@@@: *8@@@ @@@@&:.#@. @o**@@@@**:@o*o@@:.:@@@@@:.o#@&*:@@@@
+@@@@@@@@@@@@* @@@@@* 8888 8@ @@@8 #@o 8@# .@ @@* :. @* @@@@ @. : &@ ** .@@@@
+@@@@@@@@@@. @ o@@@@@* *@@@o::& .* 8@@@@. @@ 8@@@@. @* @@@@ @. @@@& * @@@@# .@@@@
+@@@@@@@@@& @ @@@@@@* @@@@@@ 8 @@@@ .. o&&&&&&& @@ #@@@@. @* @@@@ @. @@@# * @@@@@ .@@@@
+@@@@@@@@@ @@o @@@@@@@* oooo* 8 @@@& @* @@@ # 88. 88. *& o#: @. @@@# *@ & .@@@@
+@@@@@@@@# @@@8 @@@@@@@* .*@@@#. *@@ @@@& :#@@@o .@@: *&@8 @o o@@: @. @@@# *@@#. :8# .@@@@
+@@@@@@@@@ @@@@ &@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@# o@@@@ @@@@@
+@@@@@& &@@@@ 8@@@@@@@@@8&8@@@@@#8#@@@o8@#&@@o&@@@&@@8@@&@@@@88@@8#@8&@@##@@@@@@#8@@#8@@88@@@@@ *@@@@@@@
+@@@# #@@@@#. @@@@@@@@@@@@@8@@8#o@@@@@o.@o*@@*.@@@.@&:8o8*@@@8&@@#@@@8@@@@8@#@@@8&@@@@@@#@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/com/baeldung/images/favicon.ico b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/com/baeldung/images/favicon.ico
new file mode 100644
index 0000000000..64105ac11c
Binary files /dev/null and b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/com/baeldung/images/favicon.ico differ
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/favicon.ico b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/favicon.ico
new file mode 100644
index 0000000000..64105ac11c
Binary files /dev/null and b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/favicon.ico differ
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/logback.xml b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/static/favicon.ico b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/static/favicon.ico
new file mode 100644
index 0000000000..64105ac11c
Binary files /dev/null and b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/static/favicon.ico differ
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error-404.html b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error-404.html
new file mode 100644
index 0000000000..555cf52de4
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error-404.html
@@ -0,0 +1,7 @@
+
+
+
+ Sorry, we couldn't find the page you were looking for.
+Go Home
+
+
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error-500.html b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error-500.html
new file mode 100644
index 0000000000..fc64c7e180
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error-500.html
@@ -0,0 +1,9 @@
+
+
+
+ Sorry, something went wrong!
+
+We're fixing it.
+Go Home
+
+
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error.html b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error.html
new file mode 100644
index 0000000000..4e953059e2
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error.html
@@ -0,0 +1,8 @@
+
+
+
+ Something went wrong!
+Our Engineers are on it.
+Go Home
+
+
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error/404.html b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error/404.html
new file mode 100644
index 0000000000..df83ce219b
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/error/404.html
@@ -0,0 +1,8 @@
+
+
+ RESOURCE NOT FOUND
+
+
+ 404 RESOURCE NOT FOUND
+
+
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/index.html b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/index.html
new file mode 100644
index 0000000000..95c68c8600
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/templates/index.html
@@ -0,0 +1,6 @@
+
+
+Welcome Home
+Success! It is working as we expected.
+
+
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/test/java/com/baeldung/failureanalyzer/FailureAnalyzerAppIntegrationTest.java b/spring-boot-modules/spring-boot-basic-customization/src/test/java/com/baeldung/failureanalyzer/FailureAnalyzerAppIntegrationTest.java
new file mode 100644
index 0000000000..2d9fb56217
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/test/java/com/baeldung/failureanalyzer/FailureAnalyzerAppIntegrationTest.java
@@ -0,0 +1,45 @@
+package com.baeldung.failureanalyzer;
+
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import com.baeldung.failureanalyzer.utils.ListAppender;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.BeanCreationException;
+import org.springframework.boot.SpringApplication;
+
+import java.util.Collection;
+import java.util.stream.Collectors;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class FailureAnalyzerAppIntegrationTest {
+
+ private static final String EXPECTED_ANALYSIS_DESCRIPTION_TITLE = "Description:";
+ private static final String EXPECTED_ANALYSIS_DESCRIPTION_CONTENT = "The bean myDAO could not be injected as com.baeldung.failureanalyzer.MyDAO because it is of type com.baeldung.failureanalyzer.MySecondDAO";
+ private static final String EXPECTED_ANALYSIS_ACTION_TITLE = "Action:";
+ private static final String EXPECTED_ANALYSIS_ACTION_CONTENT = "Consider creating a bean with name myDAO of type com.baeldung.failureanalyzer.MyDAO";
+
+ @BeforeEach
+ public void clearLogList() {
+ ListAppender.clearEventList();
+ }
+
+ @Test
+ public void givenBeanCreationErrorInContext_whenContextLoaded_thenFailureAnalyzerLogsReport() {
+ try {
+ SpringApplication.run(FailureAnalyzerApplication.class);
+ } catch (BeanCreationException e) {
+ Collection allLoggedEntries = ListAppender.getEvents()
+ .stream()
+ .map(ILoggingEvent::getFormattedMessage)
+ .collect(Collectors.toList());
+ assertThat(allLoggedEntries).anyMatch(entry -> entry.contains(EXPECTED_ANALYSIS_DESCRIPTION_TITLE))
+ .anyMatch(entry -> entry.contains(EXPECTED_ANALYSIS_DESCRIPTION_CONTENT))
+ .anyMatch(entry -> entry.contains(EXPECTED_ANALYSIS_ACTION_TITLE))
+ .anyMatch(entry -> entry.contains(EXPECTED_ANALYSIS_ACTION_CONTENT));
+ return;
+ }
+ throw new IllegalStateException("Context load should be failing due to a BeanCreationException!");
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/test/java/com/baeldung/failureanalyzer/utils/ListAppender.java b/spring-boot-modules/spring-boot-basic-customization/src/test/java/com/baeldung/failureanalyzer/utils/ListAppender.java
new file mode 100644
index 0000000000..091cd687f1
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/test/java/com/baeldung/failureanalyzer/utils/ListAppender.java
@@ -0,0 +1,25 @@
+package com.baeldung.failureanalyzer.utils;
+
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.AppenderBase;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ListAppender extends AppenderBase {
+
+ static private List events = new ArrayList<>();
+
+ @Override
+ protected void append(ILoggingEvent eventObject) {
+ events.add(eventObject);
+ }
+
+ public static List getEvents() {
+ return events;
+ }
+
+ public static void clearEventList() {
+ events.clear();
+ }
+}
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/test/resources/logback-test.xml b/spring-boot-modules/spring-boot-basic-customization/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000..6919a457cb
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/test/resources/logback-test.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file