Slide 28
Slide 28 text
Dynamic Dependency Injection
コードサンプル
Interface BeanFactory
Bean Scopes
1 @Configuration
2 @RequiredArgsConstructor
3 public class WarmupConfiguration {
4 private final BeanFactory beanFactory;
5 private final WarmupService warmupService;
6
7 @Bean
8 @Primary
9 @Scope(value = "prototype", proxyMode = ScopedProxyMode.INTERFACES)
10 public OrderRepository orderRepository() {
11 return beanFactory.getBean(warmupService.getMode() + "OrderRepository", OrderRepository.class);
12 }
13 }