Skip to content

Commit 6c3a03f

Browse files
author
eugenp
committed
further exceptions work
1 parent 8ec7ccd commit 6c3a03f

7 files changed

Lines changed: 130 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.baeldung.ex.beandefinitionstoreexception.cause2;
2+
3+
import org.springframework.beans.factory.annotation.Value;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class BeanA {
8+
9+
@Value("${some.property2}")
10+
private String someProperty2;
11+
12+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.baeldung.ex.beandefinitionstoreexception.spring;
2+
3+
import org.springframework.context.annotation.ComponentScan;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.context.annotation.ImportResource;
6+
7+
@Configuration
8+
@ComponentScan("org.baeldung.ex.beandefinitionstoreexception.cause1")
9+
@ImportResource("beans.xml")
10+
public class Cause1ContextWithJavaConfig {
11+
12+
public Cause1ContextWithJavaConfig() {
13+
super();
14+
}
15+
16+
// beans
17+
18+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.baeldung.ex.beandefinitionstoreexception.spring;
2+
3+
import org.springframework.beans.factory.annotation.Value;
4+
import org.springframework.context.annotation.Bean;
5+
import org.springframework.context.annotation.ComponentScan;
6+
import org.springframework.context.annotation.Configuration;
7+
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
8+
9+
@Configuration
10+
@ComponentScan("org.baeldung.ex.beandefinitionstoreexception.cause2")
11+
public class Cause2ContextWithJavaConfig {
12+
13+
@Value("${some.property}")
14+
private String someProperty;
15+
16+
public Cause2ContextWithJavaConfig() {
17+
super();
18+
}
19+
20+
// beans
21+
22+
@Bean
23+
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
24+
return new PropertySourcesPlaceholderConfigurer();
25+
}
26+
27+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.baeldung.ex.beandefinitionstoreexception.spring;
2+
3+
import org.springframework.context.annotation.ComponentScan;
4+
import org.springframework.context.annotation.Configuration;
5+
6+
@Configuration
7+
@ComponentScan("org.baeldung.ex.beandefinitionstoreexception.cause3")
8+
public class Cause3ContextWithJavaConfig {
9+
10+
public Cause3ContextWithJavaConfig() {
11+
super();
12+
}
13+
14+
// beans
15+
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.baeldung.ex.beandefinitionstoreexception;
2+
3+
import org.baeldung.ex.beandefinitionstoreexception.spring.Cause1ContextWithJavaConfig;
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 = { Cause1ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
12+
public class Cause1BeanDefinitionStoreExceptionIntegrationTest {
13+
14+
@Test
15+
public final void givenContextIsInitialized_thenNoException() {
16+
//
17+
}
18+
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.baeldung.ex.beandefinitionstoreexception;
2+
3+
import org.baeldung.ex.beandefinitionstoreexception.spring.Cause2ContextWithJavaConfig;
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 = { Cause2ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
12+
public class Cause2BeanDefinitionStoreExceptionIntegrationTest {
13+
14+
@Test
15+
public final void givenContextIsInitialized_thenNoException() {
16+
//
17+
}
18+
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.baeldung.ex.beandefinitionstoreexception;
2+
3+
import org.baeldung.ex.beandefinitionstoreexception.spring.Cause3ContextWithJavaConfig;
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 = { Cause3ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
12+
public class Cause3BeanDefinitionStoreExceptionIntegrationTest {
13+
14+
@Test
15+
public final void givenContextIsInitialized_thenNoException() {
16+
//
17+
}
18+
19+
}

0 commit comments

Comments
 (0)