From 0ff98874f7cdbc74e29805a045a090a9ede4af0c Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 13 Sep 2018 22:16:08 +0530 Subject: [PATCH] BAEL-8964 Add a section in "NoSuchBeanDefinition" article - Added example for no such bean definition example. --- .../nosuchbeandefinitionexception/BeanA.java | 12 ++++++++++++ .../nosuchbeandefinitionexception/BeanB.java | 5 +++++ .../NoSuchBeanDefinitionDemoApp.java | 12 ++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/BeanA.java create mode 100644 spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/BeanB.java create mode 100644 spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/NoSuchBeanDefinitionDemoApp.java diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/BeanA.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/BeanA.java new file mode 100644 index 0000000000..21d7007917 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/BeanA.java @@ -0,0 +1,12 @@ +package com.baeldung.springbootmvc.nosuchbeandefinitionexception; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class BeanA { + + @Autowired + BeanB dependency; + +} \ No newline at end of file diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/BeanB.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/BeanB.java new file mode 100644 index 0000000000..3dd72aacc6 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/BeanB.java @@ -0,0 +1,5 @@ +package com.baeldung.springbootmvc.nosuchbeandefinitionexception; + +public class BeanB { + +} diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/NoSuchBeanDefinitionDemoApp.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/NoSuchBeanDefinitionDemoApp.java new file mode 100644 index 0000000000..01d19437c5 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/nosuchbeandefinitionexception/NoSuchBeanDefinitionDemoApp.java @@ -0,0 +1,12 @@ +package com.baeldung.springbootmvc.nosuchbeandefinitionexception; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class NoSuchBeanDefinitionDemoApp { + + public static void main(String[] args) { + SpringApplication.run(NoSuchBeanDefinitionDemoApp.class, args); + } +}