source code for BAEL-3303
This commit is contained in:
parent
1d579ff74f
commit
24d0fd2781
@ -5,7 +5,6 @@ import org.junit.runner.RunWith;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package com.baeldung.beandefinitionoverrideexception;
|
package com.baeldung.beandefinitionoverrideexception;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan()
|
|
||||||
public class TestConfiguration1 {
|
public class TestConfiguration1 {
|
||||||
|
|
||||||
class TestBean1 {
|
class TestBean1 {
|
||||||
@ -16,10 +14,13 @@ public class TestConfiguration1 {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public TestBean1 testBean(){
|
public TestBean1 testBean() {
|
||||||
return new TestBean1();
|
return new TestBean1();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.baeldung.beandefinitionoverrideexception;
|
|||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class TestConfiguration2 {
|
public class TestConfiguration2 {
|
||||||
@ -15,10 +14,14 @@ public class TestConfiguration2 {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public TestBean2 testBean(){
|
public TestBean2 testBean() {
|
||||||
return new TestBean2();
|
return new TestBean2();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user