SpringBoot Annotation

이기현·2020년 12월 17일

Spring Boot

목록 보기
5/12

@service
This annotation serves as a specialization of @Component,allowing for implementation classes to be autodetected through classpath scanning.

-- Error
Field nexacroService in com.example.demo.MainController required a bean of type 'com.example.service.NexacroService' that could not be found.

해당 에러는 bean을 찾지 못해서 발생하는 에러이다. 이것을 해결하기 위해서는
Service class에 @Component 나 @Service Annotion을 사용해야 한다.
또한 해당 Service interface를 implement하는 class에 implements를 명시해주어야 한다
implements NexacroService

profile
실력을 쌓아가는 하루하루

0개의 댓글