logo

Spring Boot Welcome Page

language-logoSpring

• 스프링 부트는 정적 및 템플릿 웰컴 페이지를 지원하며, 먼저 설정된 정적 콘텐츠 위치에서 index.html 파일을 찾습니다. 만약 찾지 못하면 index 템플릿을 찾습니다. 둘 중 하나를 찾으면 자동으로 애플리케이션의 웰컴 페이지로 사용됩니다.
• static 폴더와 templates 폴더에 index.html이 모두 있는 경우, static 폴더의 index.html이 우선적으로 웰컴 페이지로 사용됩니다.
• Spring Boot에서는 WebMvcAutoConfiguration 클래스의 getWelcomePage() 메서드를 통해 static 폴더나 templates 폴더에 index.html 파일이 있는지 확인하고, 있으면 해당 페이지를 환영 페이지로 설정한다.
• 만약 두 폴더 모두 index.html 파일이 없다면, 에러 메시지를 출력하게 된다. 이는 WelcomePageHandlerMapping 클래스에서 welcomePage가 없고, welcomeTemplateExists() 메서드를 통해 templates 폴더의 index controller도 없다면 에러 메시지를 출력하도록 설정되어 있기 때문이다.

thumbnail
북마크
공유하기
신고하기
3분 분량
조회수 157
profile-image말코
일 년 전
Copyright © 2025. Codenary All Rights Reserved.