exception work
This commit is contained in:
parent
3433af9223
commit
429fe66727
|
@ -0,0 +1,8 @@
|
|||
package org.baeldung.ex.beancreationexception.cause4;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public abstract class BeanA implements IBeanA {
|
||||
//
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package org.baeldung.ex.beancreationexception.cause4;
|
||||
|
||||
public interface IBeanA {
|
||||
//
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package org.baeldung.ex.beancreationexception.cause5;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class BeanA implements IBeanA {
|
||||
|
||||
public BeanA(final String name) {
|
||||
super();
|
||||
System.out.println(name);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package org.baeldung.ex.beancreationexception.cause5;
|
||||
|
||||
public interface IBeanA {
|
||||
//
|
||||
}
|
|
@ -2,9 +2,11 @@ package org.baeldung.ex.beancreationexception.spring;
|
|||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan("org.baeldung.ex.beancreationexception.cause4")
|
||||
@ImportResource("classpath:beancreationexception_cause4.xml")
|
||||
public class Cause4ContextWithJavaConfig {
|
||||
|
||||
public Cause4ContextWithJavaConfig() {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package org.baeldung.ex.beancreationexception.spring;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan("org.baeldung.ex.beancreationexception.cause5")
|
||||
public class Cause5ContextWithJavaConfig {
|
||||
|
||||
public Cause5ContextWithJavaConfig() {
|
||||
super();
|
||||
}
|
||||
|
||||
// beans
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package org.baeldung.ex.beancreationexception.spring;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan("org.baeldung.ex.beancreationexception.cause6")
|
||||
public class Cause6ContextWithJavaConfig {
|
||||
|
||||
public Cause6ContextWithJavaConfig() {
|
||||
super();
|
||||
}
|
||||
|
||||
// beans
|
||||
|
||||
}
|
|
@ -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" class="org.baeldung.ex.beancreationexception.cause4.BeanA" />
|
||||
|
||||
</beans>
|
|
@ -0,0 +1,19 @@
|
|||
package org.baeldung.ex.beancreationexception;
|
||||
|
||||
import org.baeldung.ex.beancreationexception.spring.Cause5ContextWithJavaConfig;
|
||||
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 = { Cause5ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
|
||||
public class Cause5BeanCreationExceptionIntegrationTest {
|
||||
|
||||
@Test
|
||||
public final void givenContextIsInitialized_thenNoException() {
|
||||
//
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.baeldung.ex.beancreationexception;
|
||||
|
||||
import org.baeldung.ex.beancreationexception.spring.Cause6ContextWithJavaConfig;
|
||||
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 = { Cause6ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
|
||||
public class Cause6BeanCreationExceptionIntegrationTest {
|
||||
|
||||
@Test
|
||||
public final void givenContextIsInitialized_thenNoException() {
|
||||
//
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue