오류문구
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageController': Unsatisfied dependency expressed through field 'messageService'('메시지서비스' 필드에 종속성 표현이 충족되지 않는다); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'net.edupoll.kr.service.MessageService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations(종속성을 가진 주석(어노테이션)): {@org.springframework.beans.factory.annotation.Autowired(required=true)}
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageController': Unsatisfied dependency expressed through field 'messageService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'net.edupoll.kr.service.MessageService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
원인
Service 클래스에 @Service 어노테이션을 붙이지 않았음
해결방법
Service 클래스에 @Service 어노테이션 붙이기
@Service
public class MessageService {
}
'언어.프레임워크 등등 DB나 도커같은거 말고' 카테고리의 다른 글
[Spring] mapper작성방법 (0) | 2022.03.22 |
---|---|
[김성박의 즐거운 프로그래밍] Main Method , JVM , LTS (0) | 2022.03.20 |
[김성박의 즐거운 프로그래밍] 변수가 값을 가질 때 VS 값을 참조할 때 (0) | 2022.03.20 |
[intelliJ] intelli J 한국어로 사용하기 (0) | 2022.03.20 |
[JAVA] 명령 프롬프트(CMD) 자바 컴파일 오류 (0) | 2022.03.19 |