zoukankan      html  css  js  c++  java
  • springboot欢迎页的处理规则

    欢迎页的处理规则
    	HandlerMapping:处理器映射。保存了每一个Handler能处理哪些请求。	
    
    	@Bean
    		public WelcomePageHandlerMapping welcomePageHandlerMapping(ApplicationContext applicationContext,
    				FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider) {
    			WelcomePageHandlerMapping welcomePageHandlerMapping = new WelcomePageHandlerMapping(
    					new TemplateAvailabilityProviders(applicationContext), applicationContext, getWelcomePage(),
    					this.mvcProperties.getStaticPathPattern());
    			welcomePageHandlerMapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
    			welcomePageHandlerMapping.setCorsConfigurations(getCorsConfigurations());
    			return welcomePageHandlerMapping;
    		}
    
    	WelcomePageHandlerMapping(TemplateAvailabilityProviders templateAvailabilityProviders,
    			ApplicationContext applicationContext, Optional<Resource> welcomePage, String staticPathPattern) {
    		if (welcomePage.isPresent() && "/**".equals(staticPathPattern)) {
                //要用欢迎页功能,必须是/**
    			logger.info("Adding welcome page: " + welcomePage.get());
    			setRootViewName("forward:index.html");
    		}
    		else if (welcomeTemplateExists(templateAvailabilityProviders, applicationContext)) {
                // 调用Controller  /index
    			logger.info("Adding welcome page template: index");
    			setRootViewName("index");
    		}
    	}
    
  • 相关阅读:
    tomcat解压版环境变量配置
    十天冲刺(第二阶段)
    十天冲刺(第二阶段)
    十天冲刺
    十天冲刺第二阶段()
    十天冲刺(第二阶段)
    十天冲刺(第二阶段)
    十天冲刺(第一阶段)
    十天冲刺(第一阶段)
    十天冲刺(第一阶段)
  • 原文地址:https://www.cnblogs.com/zhukaile/p/14104009.html
Copyright © 2011-2022 走看看