springboot 自定义webroot的目录

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/shuaizai88/article/details/83144754
@Bean
public  EmbeddedServletContainerCustomizer documentDirectoryCustomizer () {
    return new EmbeddedServletContainerCustomizer() {

        public void customize(ConfigurableEmbeddedServletContainer container) {
            LOGGER.info("当前JSP加载目录为:" + jspPath);
            File jspDirFile = new File(jspPath);
            if(!jspDirFile.exists())
            {
                LOGGER.error("JSP目录不存在:" + jspPath);
                System.exit(0);
            }
            container.setDocumentRoot(jspDirFile);
        }
    };
}

猜你喜欢

转载自blog.csdn.net/shuaizai88/article/details/83144754
今日推荐