에러 발생 상황
public class ComponentFilterAppConfigTest {
@Test
void filterScan() {
AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext();
BeanA beanA = ac.getBean("beanA", BeanA.class);
assertThat(beanA).isNotNull();
}
@Configuration
@ComponentScan(
includeFilters = @Filter(type = FilterType.ANNOTATION, classes = MyIncludeComponent.class),
excludeFilters = @Filter(type = FilterType.ANNOTATION, classes = MyExcludeComponent.class)
)
static class ComponentFilterAppConfig {
}
}
위의 코드 강의 실습 중 테스트를 실행했더니 아래와 같은 오류가 발생했다.
문제 파악
자세히 보니 AnnotationConfigApplicationContext(); 괄호에 파라미터로 클래스를 지정 안 해줬다.
문제 해결
AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(ComponentFilterAppConfig.class);
클래스를 지정해줬더니 잘 실행된다.
'오류 로그' 카테고리의 다른 글
인텔리제이 properties 한글 깨짐 (0) | 2022.01.21 |
---|---|
인텔리제이에서 특정 파일명의 확장자를 다르게 인식할 때 (0) | 2022.01.17 |
인텔리제이 콘솔창 한글 깨짐 (0) | 2022.01.08 |
인텔리제이 org.thymeleaf.exceptions.TemplateInputException (0) | 2021.12.18 |
인텔리제이 org.opentest4j.AssertionFailedError (0) | 2021.12.16 |