inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

@SpringBootTest에서 어떻게 @Autowired가 작동하는지 궁금합니다

해결됨

스프링 핵심 원리 - 기본편

안녕하세요~ 유익한 강의 잘 듣고 있습니다! 이해가 안가는 부분이 있어 질문드립니다. 24분 40초 쯤에 보면 @SpringBootTest 클래스에서 @Autowired를 사용하고 있습니다. 이게 어떻게 동작하는지 모르겠습니다. 1. 일전에, ComponetScan의 범위는 AutoAppConfig가 포함된 패키지 이하라고 하셨습니다. 이에 따르면 test, resources는 컴포넌트 스캔의 대상이 아닙니다 2. 의존관계 주입 대상은 컨테이너에 빈이라고 하셨습니다. 그렇다면 @SpringBootTest 클래스(CoreApplicationTest)는 빈 등록 대상이 아니므로 Autowired가 불가능한 것 아닌가요?? 어떤 과정을 거쳐 @SpringBootTest 클래스에 빈이 주입되는지 궁금합니다!

  • @SpringBootTest
  • @Autowired
  • oop
  • spring
최재량 댓글 1 좋아요 2 조회수 2417

@SpringBootTest 테스트 오류

해결됨

스프링 시큐리티

안녕하세요. 수업 감사히 잘 들었습니다. spring security를 적용하면 @SpringBootTest 테스트 코드에서 아래 오류가 발생합니다. test시 security 작용을 disable 시켜야 하는 건지 해결 방범이 궁금합니다. Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'resourcesController': Unsatisfied dependency expressed through field 'methodSecurityService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodSecurityService' defined in file [path\security\service\MethodSecurityService.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

  • @SpringBootTest
  • java
  • Spring Security
  • spring-boot
Jinseok Han 댓글 2 좋아요 0 조회수 600

인기 태그

인프런 TOP Writers

주간 인기글