From 6c3a03f9298291ade562ab7f11c579c3ec47d90a Mon Sep 17 00:00:00 2001 From: eugenp Date: Sun, 11 Aug 2013 17:00:24 +0300 Subject: [PATCH] further exceptions work --- .../cause2/BeanA.java | 12 +++++++++ .../spring/Cause1ContextWithJavaConfig.java | 18 +++++++++++++ .../spring/Cause2ContextWithJavaConfig.java | 27 +++++++++++++++++++ .../spring/Cause3ContextWithJavaConfig.java | 16 +++++++++++ ...finitionStoreExceptionIntegrationTest.java | 19 +++++++++++++ ...finitionStoreExceptionIntegrationTest.java | 19 +++++++++++++ ...finitionStoreExceptionIntegrationTest.java | 19 +++++++++++++ 7 files changed, 130 insertions(+) create mode 100644 spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/cause2/BeanA.java create mode 100644 spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause1ContextWithJavaConfig.java create mode 100644 spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause2ContextWithJavaConfig.java create mode 100644 spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause3ContextWithJavaConfig.java create mode 100644 spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionIntegrationTest.java create mode 100644 spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionIntegrationTest.java create mode 100644 spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionIntegrationTest.java diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/cause2/BeanA.java b/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/cause2/BeanA.java new file mode 100644 index 0000000000..a0aefda1cd --- /dev/null +++ b/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/cause2/BeanA.java @@ -0,0 +1,12 @@ +package org.baeldung.ex.beandefinitionstoreexception.cause2; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +public class BeanA { + + @Value("${some.property2}") + private String someProperty2; + +} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause1ContextWithJavaConfig.java b/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause1ContextWithJavaConfig.java new file mode 100644 index 0000000000..3b6b4f2b8d --- /dev/null +++ b/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause1ContextWithJavaConfig.java @@ -0,0 +1,18 @@ +package org.baeldung.ex.beandefinitionstoreexception.spring; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.ImportResource; + +@Configuration +@ComponentScan("org.baeldung.ex.beandefinitionstoreexception.cause1") +@ImportResource("beans.xml") +public class Cause1ContextWithJavaConfig { + + public Cause1ContextWithJavaConfig() { + super(); + } + + // beans + +} \ No newline at end of file diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause2ContextWithJavaConfig.java b/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause2ContextWithJavaConfig.java new file mode 100644 index 0000000000..d31890e0f3 --- /dev/null +++ b/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause2ContextWithJavaConfig.java @@ -0,0 +1,27 @@ +package org.baeldung.ex.beandefinitionstoreexception.spring; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; + +@Configuration +@ComponentScan("org.baeldung.ex.beandefinitionstoreexception.cause2") +public class Cause2ContextWithJavaConfig { + + @Value("${some.property}") + private String someProperty; + + public Cause2ContextWithJavaConfig() { + super(); + } + + // beans + + @Bean + public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { + return new PropertySourcesPlaceholderConfigurer(); + } + +} \ No newline at end of file diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause3ContextWithJavaConfig.java b/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause3ContextWithJavaConfig.java new file mode 100644 index 0000000000..11a00b1770 --- /dev/null +++ b/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause3ContextWithJavaConfig.java @@ -0,0 +1,16 @@ +package org.baeldung.ex.beandefinitionstoreexception.spring; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan("org.baeldung.ex.beandefinitionstoreexception.cause3") +public class Cause3ContextWithJavaConfig { + + public Cause3ContextWithJavaConfig() { + super(); + } + + // beans + +} \ No newline at end of file diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionIntegrationTest.java new file mode 100644 index 0000000000..8de51a4bf0 --- /dev/null +++ b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionIntegrationTest.java @@ -0,0 +1,19 @@ +package org.baeldung.ex.beandefinitionstoreexception; + +import org.baeldung.ex.beandefinitionstoreexception.spring.Cause1ContextWithJavaConfig; +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 = { Cause1ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class) +public class Cause1BeanDefinitionStoreExceptionIntegrationTest { + + @Test + public final void givenContextIsInitialized_thenNoException() { + // + } + +} diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionIntegrationTest.java new file mode 100644 index 0000000000..8dbc50cda5 --- /dev/null +++ b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionIntegrationTest.java @@ -0,0 +1,19 @@ +package org.baeldung.ex.beandefinitionstoreexception; + +import org.baeldung.ex.beandefinitionstoreexception.spring.Cause2ContextWithJavaConfig; +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 = { Cause2ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class) +public class Cause2BeanDefinitionStoreExceptionIntegrationTest { + + @Test + public final void givenContextIsInitialized_thenNoException() { + // + } + +} diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionIntegrationTest.java new file mode 100644 index 0000000000..370b67e2fa --- /dev/null +++ b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionIntegrationTest.java @@ -0,0 +1,19 @@ +package org.baeldung.ex.beandefinitionstoreexception; + +import org.baeldung.ex.beandefinitionstoreexception.spring.Cause3ContextWithJavaConfig; +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 = { Cause3ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class) +public class Cause3BeanDefinitionStoreExceptionIntegrationTest { + + @Test + public final void givenContextIsInitialized_thenNoException() { + // + } + +}