728x90
반응형
요즘 다시 백엔드 공부를 하고 있습니다...
정말 많이 돌아왔네요...
자 아무튼 김영한님의 스프링 강의를 보면서 하다가 System.out.print를 했는데 안나오시는 경우가 생겼습니다.
원인
ServletApplication의 @ServletComponentScan 어노테이션이 없어서 그렇습니다.
@SpringBootApplication
public class ServletApplication {
public static void main(String[] args) {
SpringApplication.run(ServletApplication.class, args);
}
}
해결
SpringBoot를 이용하는데 Boot에서 Servlet을 이용하려면 @@ServletComponentScan 어노테이션이 필요합니다.
@SpringBootApplication
@ServletComponentScan
public class ServletApplication {
public static void main(String[] args) {
SpringApplication.run(ServletApplication.class, args);
}
}
반응형
'개발자의 공부방 > 스프링' 카테고리의 다른 글
스프링] 쿠키의 Same Site를 알아보자 (0) | 2023.08.11 |
---|---|
스프링] data.sql 에러 (0) | 2023.08.09 |
스프링 기초] IoC 제어의 역전과 프레임워크 그리고 라이브러리. (0) | 2021.11.03 |
스프링 기초] 스프링 핵심 원리 [강의 정리 중] (0) | 2021.11.02 |
스프링 기초] 스프링과 스프링부트의 차이점. (0) | 2021.10.20 |