forked from eugenp/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
eugenp
committed
Aug 11, 2013
1 parent
075dd7b
commit 7da1bc0
Showing
6 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/BeanA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.baeldung.ex.beancreationexception.cause9; | ||
|
||
public abstract class BeanA implements IBeanA { | ||
// | ||
} |
8 changes: 8 additions & 0 deletions
8
spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/BeanB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.baeldung.ex.beancreationexception.cause9; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class BeanB { | ||
// | ||
} |
5 changes: 5 additions & 0 deletions
5
spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/IBeanA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.baeldung.ex.beancreationexception.cause9; | ||
|
||
public interface IBeanA { | ||
// | ||
} |
30 changes: 30 additions & 0 deletions
30
...c/main/java/org/baeldung/ex/beancreationexception/spring/Cause9ContextWithJavaConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.baeldung.ex.beancreationexception.spring; | ||
|
||
import org.baeldung.ex.beancreationexception.cause9.BeanB; | ||
import org.springframework.beans.factory.BeanFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.ImportResource; | ||
|
||
@Configuration | ||
@ComponentScan("org.baeldung.ex.beancreationexception.cause9") | ||
@ImportResource("classpath:beancreationexception_cause9.xml") | ||
public class Cause9ContextWithJavaConfig { | ||
@Autowired | ||
BeanFactory beanFactory; | ||
|
||
public Cause9ContextWithJavaConfig() { | ||
super(); | ||
} | ||
|
||
// beans | ||
|
||
@Bean | ||
public BeanB beanB() { | ||
beanFactory.getBean("beanA"); | ||
return new BeanB(); | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
spring-exceptions/src/main/resources/beancreationexception_cause9.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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" | ||
xmlns:util="http://www.springframework.org/schema/util" | ||
xsi:schemaLocation=" | ||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd | ||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd | ||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> | ||
|
||
<bean id="beanA" abstract="true" class="org.baeldung.ex.beancreationexception.cause9.BeanA" /> | ||
|
||
</beans> |
19 changes: 19 additions & 0 deletions
19
...ava/org/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.baeldung.ex.beancreationexception; | ||
|
||
import org.baeldung.ex.beancreationexception.spring.Cause9ContextWithJavaConfig; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||
import org.springframework.test.context.support.AnnotationConfigContextLoader; | ||
|
||
@RunWith(SpringJUnit4ClassRunner.class) | ||
@ContextConfiguration(classes = { Cause9ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class) | ||
public class Cause9BeanCreationExceptionIntegrationTest { | ||
|
||
@Test | ||
public final void givenContextIsInitialized_thenNoException() { | ||
// | ||
} | ||
|
||
} |