Skip to content

Commit 3433af9

Browse files
author
eugenp
committed
example for reproducing various exceptions
1 parent 873d76b commit 3433af9

15 files changed

+202
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.baeldung.ex.beancreationexception.cause1;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class BeanA {
8+
9+
@Autowired
10+
private BeanB dependency;
11+
12+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.baeldung.ex.beancreationexception.cause1;
2+
3+
public class BeanB {
4+
//
5+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.baeldung.ex.beancreationexception.cause2;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class BeanA {
8+
9+
@Autowired
10+
private IBeanB dependency;
11+
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package org.baeldung.ex.beancreationexception.cause2;
2+
3+
import org.springframework.stereotype.Component;
4+
5+
@Component
6+
public class BeanB1 implements IBeanB {
7+
//
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package org.baeldung.ex.beancreationexception.cause2;
2+
3+
import org.springframework.stereotype.Component;
4+
5+
@Component
6+
public class BeanB2 implements IBeanB {
7+
//
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.baeldung.ex.beancreationexception.cause2;
2+
3+
public interface IBeanB {
4+
//
5+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.baeldung.ex.beancreationexception.cause3;
2+
3+
import org.springframework.stereotype.Component;
4+
5+
@Component
6+
public class BeanA {
7+
8+
public BeanA() {
9+
super();
10+
throw new NullPointerException();
11+
}
12+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.baeldung.ex.beancreationexception.spring;
2+
3+
import org.springframework.context.annotation.ComponentScan;
4+
import org.springframework.context.annotation.Configuration;
5+
6+
@Configuration
7+
@ComponentScan("org.baeldung.ex.beancreationexception.cause1")
8+
public class Cause1ContextWithJavaConfig {
9+
10+
public Cause1ContextWithJavaConfig() {
11+
super();
12+
}
13+
14+
// beans
15+
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.baeldung.ex.beancreationexception.spring;
2+
3+
import org.springframework.context.annotation.ComponentScan;
4+
import org.springframework.context.annotation.Configuration;
5+
6+
@Configuration
7+
@ComponentScan("org.baeldung.ex.beancreationexception.cause2")
8+
public class Cause2ContextWithJavaConfig {
9+
10+
public Cause2ContextWithJavaConfig() {
11+
super();
12+
}
13+
14+
// beans
15+
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.baeldung.ex.beancreationexception.spring;
2+
3+
import org.springframework.context.annotation.ComponentScan;
4+
import org.springframework.context.annotation.Configuration;
5+
6+
@Configuration
7+
@ComponentScan("org.baeldung.ex.beancreationexception.cause3")
8+
public class Cause3ContextWithJavaConfig {
9+
10+
public Cause3ContextWithJavaConfig() {
11+
super();
12+
}
13+
14+
// beans
15+
16+
}

0 commit comments

Comments
 (0)