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);
}
}
반응형
'개발자의 공부방 > 스프링' 카테고리의 다른 글
스프링 기초] 스프링 핵심 원리 [강의 정리 중] (0) | 2021.11.02 |
---|---|
스프링 기초] 스프링과 스프링부트의 차이점. (0) | 2021.10.20 |
Spring] JSON을 내려 줄 때 불필요한 값(필드) 삭제하기. (0) | 2021.04.14 |
스프링] 에러 : java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed; 해결법 feat. 스프링부트 (0) | 2020.03.27 |
스프링부트] 목록 리스트 (0) | 2020.03.26 |