
Spring에서 명시적 구성을 암시적 구성으로 변환
2022-10-05 last update
5 minutes reading annotation configuration spring java이전(명시적 빈 정의)
이후(암시적 구성)
@Configuration
public class AppConfig {
@Bean
public AppService appService() {
return new AppServiceImpl(appRepository());
}
@Bean
public AppRepository appRepository() {
...
}
}
이후(암시적 구성)
@Configuration
@ComponentScan("com.services")
public class AppConfig {
}
@Component
public class AppServiceImpl implements AppService {
@Autowired
public AppServiceImpl(AppRepository appRepository) {
this.appRepository = appRepository;
}
}