diff --git a/spring-boot-modules/spring-boot-basic-customization/pom.xml b/spring-boot-modules/spring-boot-basic-customization/pom.xml
index 828ee42b95..ef56623775 100644
--- a/spring-boot-modules/spring-boot-basic-customization/pom.xml
+++ b/spring-boot-modules/spring-boot-basic-customization/pom.xml
@@ -16,6 +16,11 @@
+
+ org.springframework.boot
+ spring-boot-starter
+
+
org.springframework.boot
spring-boot-starter-web
@@ -27,5 +32,4 @@
test
-
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java
new file mode 100644
index 0000000000..d08fa05c6e
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java
@@ -0,0 +1,14 @@
+package com.baeldung.failureanalyzer;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+import javax.annotation.security.RolesAllowed;
+
+@SpringBootApplication
+public class FailureAnalyzerApplication {
+ @RolesAllowed("*")
+ public static void main(String[] args) {
+ SpringApplication.run(FailureAnalyzerApplication.class, args);
+ }
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MyBeanNotOfRequiredTypeFailureAnalyzer.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MyBeanNotOfRequiredTypeFailureAnalyzer.java
new file mode 100644
index 0000000000..3949908083
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MyBeanNotOfRequiredTypeFailureAnalyzer.java
@@ -0,0 +1,22 @@
+package com.baeldung.failureanalyzer;
+
+import org.springframework.beans.factory.BeanNotOfRequiredTypeException;
+import org.springframework.boot.diagnostics.AbstractFailureAnalyzer;
+import org.springframework.boot.diagnostics.FailureAnalysis;
+
+public class MyBeanNotOfRequiredTypeFailureAnalyzer extends AbstractFailureAnalyzer {
+
+ @Override
+ protected FailureAnalysis analyze(Throwable rootFailure, BeanNotOfRequiredTypeException cause) {
+ return new FailureAnalysis(getDescription(cause), getAction(cause), cause);
+ }
+
+ private String getDescription(BeanNotOfRequiredTypeException ex) {
+ return String.format("The bean %s could not be injected as %s because it is of type %s", ex.getBeanName(), ex.getRequiredType().getName(), ex.getActualType().getName());
+ }
+
+ private String getAction(BeanNotOfRequiredTypeException ex) {
+ return String.format("Consider creating a bean with name %s of type %s", ex.getBeanName(), ex.getRequiredType().getName());
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MyDAO.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MyDAO.java
new file mode 100644
index 0000000000..ddaeb28574
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MyDAO.java
@@ -0,0 +1,5 @@
+package com.baeldung.failureanalyzer;
+
+public class MyDAO {
+
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MySecondDAO.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MySecondDAO.java
new file mode 100644
index 0000000000..12dd73a05b
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MySecondDAO.java
@@ -0,0 +1,8 @@
+package com.baeldung.failureanalyzer;
+
+import org.springframework.stereotype.Repository;
+
+@Repository("myDAO")
+public class MySecondDAO {
+
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MyService.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MyService.java
new file mode 100644
index 0000000000..f31b67615f
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/failureanalyzer/MyService.java
@@ -0,0 +1,13 @@
+package com.baeldung.failureanalyzer;
+
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service
+public class MyService {
+
+ @Resource(name = "myDAO")
+ private MyDAO myDAO;
+
+}
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
+