Skip to content

Commit 429fe66

Browse files
author
eugenp
committed
exception work
1 parent 3433af9 commit 429fe66

File tree

10 files changed

+114
-0
lines changed

10 files changed

+114
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package org.baeldung.ex.beancreationexception.cause4;
2+
3+
import org.springframework.stereotype.Component;
4+
5+
@Component
6+
public abstract class BeanA implements IBeanA {
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.cause4;
2+
3+
public interface IBeanA {
4+
//
5+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.baeldung.ex.beancreationexception.cause5;
2+
3+
import org.springframework.stereotype.Component;
4+
5+
@Component
6+
public class BeanA implements IBeanA {
7+
8+
public BeanA(final String name) {
9+
super();
10+
System.out.println(name);
11+
}
12+
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.baeldung.ex.beancreationexception.cause5;
2+
3+
public interface IBeanA {
4+
//
5+
}

spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause4ContextWithJavaConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
import org.springframework.context.annotation.ComponentScan;
44
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.context.annotation.ImportResource;
56

67
@Configuration
78
@ComponentScan("org.baeldung.ex.beancreationexception.cause4")
9+
@ImportResource("classpath:beancreationexception_cause4.xml")
810
public class Cause4ContextWithJavaConfig {
911

1012
public Cause4ContextWithJavaConfig() {
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.cause5")
8+
public class Cause5ContextWithJavaConfig {
9+
10+
public Cause5ContextWithJavaConfig() {
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.cause6")
8+
public class Cause6ContextWithJavaConfig {
9+
10+
public Cause6ContextWithJavaConfig() {
11+
super();
12+
}
13+
14+
// beans
15+
16+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
3+
xmlns:util="http://www.springframework.org/schema/util"
4+
xsi:schemaLocation="
5+
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
6+
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
7+
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
8+
9+
<bean id="beanA" class="org.baeldung.ex.beancreationexception.cause4.BeanA" />
10+
11+
</beans>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.baeldung.ex.beancreationexception;
2+
3+
import org.baeldung.ex.beancreationexception.spring.Cause5ContextWithJavaConfig;
4+
import org.junit.Test;
5+
import org.junit.runner.RunWith;
6+
import org.springframework.test.context.ContextConfiguration;
7+
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
8+
import org.springframework.test.context.support.AnnotationConfigContextLoader;
9+
10+
@RunWith(SpringJUnit4ClassRunner.class)
11+
@ContextConfiguration(classes = { Cause5ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
12+
public class Cause5BeanCreationExceptionIntegrationTest {
13+
14+
@Test
15+
public final void givenContextIsInitialized_thenNoException() {
16+
//
17+
}
18+
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.baeldung.ex.beancreationexception;
2+
3+
import org.baeldung.ex.beancreationexception.spring.Cause6ContextWithJavaConfig;
4+
import org.junit.Test;
5+
import org.junit.runner.RunWith;
6+
import org.springframework.test.context.ContextConfiguration;
7+
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
8+
import org.springframework.test.context.support.AnnotationConfigContextLoader;
9+
10+
@RunWith(SpringJUnit4ClassRunner.class)
11+
@ContextConfiguration(classes = { Cause6ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
12+
public class Cause6BeanCreationExceptionIntegrationTest {
13+
14+
@Test
15+
public final void givenContextIsInitialized_thenNoException() {
16+
//
17+
}
18+
19+
}

0 commit comments

Comments
 (0)