JAVA-959: Migrate spring-di to com.baeldung
This commit is contained in:
23
spring-di/src/main/java/com/baeldung/store/AppConfig.java
Normal file
23
spring-di/src/main/java/com/baeldung/store/AppConfig.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.baeldung.store;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
public class AppConfig {
|
||||
|
||||
@Bean
|
||||
public Item item1() {
|
||||
return new ItemImpl1();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Store storeThroughConstructorInjection() {
|
||||
return new Store(item1());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Store storeThroughSetterInjection() {
|
||||
Store store = new Store();
|
||||
store.setItem(item1());
|
||||
return store;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user