Consider defining a bean of type 'org.springframework.stereotype.Repository' in your configuration.
코드를 돌리니 위와 같은 에러가 발생했다.
에러 코드를 좀 더 살펴보니 아래와 같은 에러 내용이 있었다.
Description:
Field repository in com.retro.dailyRetro.board.controller.BoardController required a bean of type 'org.springframework.stereotype.Repository' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
즉, controller에서 annotation관련한 에러가 있었다.
controller에서 필요한 annotation은 아래와 같다.
@Autowired
private BoardService boardService;
@Autowired
private Repository repository;
내 코드를 살펴보니 repository 인터페이스를 빈으로 등록하는 과정에서 인터페이스명에 오류가 있었다.
수정한 코드는 아래와 같다.
@Autowired
private BoardService boardService;
@Autowired
private BoardRepository repository;