-
[Spring] JUnit - unsatisfied dependency mockmvc 에러Back End/Spring Boot 2021. 11. 30. 19:05
# 에러 사항
- MockMvc Bean 을 주입 받지 못함
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.bookmarkmanager.bookmarkmanager.main.login.LoginApiTest': Unsatisfied dependency expressed through field 'mockMvc'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.test.web.servlet.MockMvc' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
# 해결 방법
- @AutoConfigureMockMvc 어노테이션을 @SpringBootTest 위치에 같이 달아둠
728x90'Back End > Spring Boot' 카테고리의 다른 글
[Spring] RESTful API 설계 가이드 (1) 2021.12.01 [Spring] JUnit API 테스트 코드 작성 (MockMvc) (0) 2021.11.30 [Spring] Swagger - REST 웹 서비스의 문서화 (0) 2021.10.16 [Spring] Jacoco - 코드 커버리지 체크하기(TDD) (0) 2021.10.15 Spring) Lombok annotation 간단 정리 (0) 2021.09.17