source code for BAEL-3303

This commit is contained in:
Yavuz Tas 2020-01-11 15:51:34 +01:00
parent 1d579ff74f
commit 24d0fd2781
3 changed files with 9 additions and 6 deletions

View File

@ -5,7 +5,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;

View File

@ -1,11 +1,9 @@
package com.baeldung.beandefinitionoverrideexception;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan()
public class TestConfiguration1 {
class TestBean1 {
@ -16,10 +14,13 @@ public class TestConfiguration1 {
return name;
}
public void setName(String name) {
this.name = name;
}
}
@Bean
public TestBean1 testBean(){
public TestBean1 testBean() {
return new TestBean1();
}

View File

@ -2,7 +2,6 @@ package com.baeldung.beandefinitionoverrideexception;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
@Configuration
public class TestConfiguration2 {
@ -15,10 +14,14 @@ public class TestConfiguration2 {
return name;
}
public void setName(String name) {
this.name = name;
}
}
@Bean
public TestBean2 testBean(){
public TestBean2 testBean() {
return new TestBean2();
}