인프런 커뮤니티 질문&답변
[해결방법] Could not autowire. No beans of 'ItemMapper' type found. 오류
작성
·
467
1
아래 코드 추가
@MapperScan("hello.itemservice.repository.mybatis")
@Configuration
@RequiredArgsConstructor
@MapperScan("hello.itemservice.repository.mybatis")
public class MyBatisConfig {
private final ItemMapper itemMapper;
@Bean
public ItemService itemService() {
return new ItemServiceV1(itemRepository());
}
@Bean
public ItemRepository itemRepository() {
return new MyBatisItemRepository(itemMapper);
}
}




