• 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");
    		}
    	}
    
  • 相关阅读:
    mysql-03
    mysql-02
    mysql-01
    RESTFUL设计风格
    mysql水平拆分和垂直拆分
    redis连环夺命问
    Python 的十大重要特性
    吊打--redis
    python2和3 的区别
    tornado第一段代码
  • 原文地址:https://www.cnblogs.com/zhukaile/p/14104009.html
Copyright © 2020-2023  润新知