Skip to content

Welcome page handling

Welcome page handling refers to the mechanism used in Spring MVC to automatically serve a specific document, typically an index.html file, when a client requests the application's root URL or a static resource path.^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md]

Implementation

In Spring Boot, this functionality is configured through the WebMvcAutoConfiguration class.^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md] This process involves a specific bean definition known as WelcomePageHandlerMapping.^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md]

WelcomePageHandlerMapping

The system utilizes a WelcomePageHandlerMapping bean to manage the redirection to the welcome page.^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md] This handler is initialized with the ApplicationContext and the static path pattern defined in the MVC properties^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md].

The configuration explicitly calls getWelcomePage() to determine the specific resource to be served^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md].

  • [[Static Resource Handling]]
  • [[WebMvcAutoConfiguration]]
  • Spring Boot

Sources

^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md]