inflearn logo
강의

講義

知識共有

1時間で終わるspring boot rest apiサービス開発

MyBatisの設定と活用

QuickMapper를 찾을 수 없다는 오류가 뜹니다. @Autowired 사용에 문제가 있는 걸까요?

421

ljpson

投稿した質問数 1

2

안녕하세요?

강의 내용이 너무 좋아서 빠져서 듣고 있습니다.

그런데 mybatis연결 과정에서 QuickMapper interface와 xml연결하는 부분 수업 중에 아래와 같은 에러가 발생했습니다.

 

에러 내용만 보면 Service 에서 QuickMapper를 @Autowired하는 부분부터 문제가 생기는 것 같은데 해결방법을 모르겠습니다.

현재 에러가 나는 상태로 git에 소스 올려두었습니다.
https://github.com/ljpson/quickstart.git

에러 내용은 아래와 같습니다.

 

2024-04-03T11:20:24.392+09:00 WARN 74964 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'quickController': Unsatisfied dependency expressed through field 'quickService': Error creating bean with name 'quickService': Unsatisfied dependency expressed through field 'quickMapper': No qualifying bean of type 'com.helloworld.quickstart.mapper.QuickMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

2024-04-03T11:20:24.395+09:00 INFO 74964 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]

2024-04-03T11:20:24.404+09:00 INFO 74964 --- [ main] .s.b.a.l.ConditionEvaluationReportLogger :

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.

2024-04-03T11:20:24.418+09:00 ERROR 74964 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :

***************************

APPLICATION FAILED TO START

***************************

Description:

Field quickMapper in com.helloworld.quickstart.service.QuickService required a bean of type 'com.helloworld.quickstart.mapper.QuickMapper' that could not be found.

The injection point has the following annotations:

- @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type 'com.helloworld.quickstart.mapper.QuickMapper' in your configuration.

Process finished with exit code 1

 

spring-boot jpa swagger mybatis

回答 3

3

ljpson

해결되었습니다.

dependency 추가할 때
mybatis-spring-boot-starter를 추가해야 하는데

mybatis를 추가했었네요ㅠ.ㅠ

 

창피해서 질문 삭제할까 하다가

혹시라도 저처럼 삽질하시는 분 계실까봐 답글로 마무리합니다.

1

Hello World

좋은 경험 하신겁니다.

xxx-starter 로 된 의존성을 넣어줘야 자동으로 bean 으로 등록해줍니다.

다들 처음할 때 이런 실수를 많이 하는데 좋은 질문과 답변입니다.

0

seukwoo88

빌드는 문제 없이 진행되었는데요, id로 item을 get하는데 1을 입력하면 apple이 return되지 않고, 다음과 같이 500 에러가 납니다.
Response body
{ "timestamp": "2025-03-28T00:02:26.146+00:00", "status": 500, "error": "Internal Server Error", "path": "/item" }

문제를 못찾겠네요.. 도와주세요! ㅎㅎ

코드는 여기 올려놨습니다.
https://github.com/seukwoo/quickstart.git

0

principle950

정확히 저도 똑같은 오류나서 질문하러 왔다가 광명 찾았습니다.. 복받으세여..

네이버 API | '검색 - 책' API 제공 중단

0

16

1

ArticleReadService 관련 질문

0

13

1

kafka 이벤트 발행 실패 시 at-least-once를 보장하는 방법이 궁금합니다.

1

36

1

domain에 @Entity 와 Repository를 함께 둔 이유가 궁금합니다

1

28

1

Part 2 듣기전 복습하던 중, 아키텍처에 관한 질문이 있습니다.

0

31

2

테스트는 인터페이스를 대상으로 만드는것에 대해 궁금한 점이 있습니다.

0

21

1

아무도 모르게 책 내시면 모르실 줄 알고!!

1

42

2

Jib 이미지 빌드에서 docker credential 관련으로 이슈가 있다면

1

58

1

리뉴얼 시기

0

38

2

스크립트에 대해 질문 있습니다.

1

53

1

같은 사용자가 연속된 중복 호출할 경우 어떻게 되는지 궁금합니다!

2

59

1

조건 검색 질문

0

31

1

JPA 엔티티로 만들었다고 기술종속이 아닌지에 대한 질문

0

49

3

콘솔 로그가 깨져나오는데 혹시 방법이 있을까요?

0

48

2

PlatformTransactionManager, ResourcelessTransactionManager 질문

1

58

2

WebFlux & Web MVC 혼용해서 사용했을 때 스레드에 대한 질문

0

31

1

@Controller 요청하는 방식에 대해 궁금합니다.

1

96

2

H2 접속 에러

0

176

3

item을 id로 get하는데 1을 넣었을 때 500에러가 나와요.

0

118

1

swagger spring boot 3 적용 run 실행 에러

0

303

2

Invalid bound statement (not found): com.helloword.fitstStart.mapper.QuickMapper.findById 에 대한 질의 입니다.

0

586

1

mybatis의 hashmap 데이터 호출시 대문자로 불러와야 되나요?

0

542

1

@Autowired 관련

0

284

1

마이바티스 - 해쉬맵

0

583

1