---
title: "spring boot 对输入的页面去掉后缀的配置"
author: "艾伦蓝"
date: "2017-11-22T10:51:58Z"
tags: []
categories: ["编程语言"]
slug: "spring-boot"
draft: true
lastmod: "2017-11-22T10:51:58Z"
id: 2400444
url: "https://forlan.iteye.com/blog/2400444"
---

\[size=medium]\[color=red]\[b]1.在application.properties文件中添加\[/b]\[/color]\[/size] \[code="properties"] spring.thymeleaf.prefix=classpath:/static/ spring.thymeleaf.suffix=.html spring.thymeleaf.mode=LEGACYHTML5 #spring.thymeleaf.encoding=UTF-8 #spring.thymeleaf.content-type=text/html # ;charset= is added spring.thymeleaf.cache=false \[/code] \[size=medium]\[color=red]\[b]2.在WebMvcConfigurerAdapter中设置相应内容\[/b]\[/color]\[/size] \[code="java"] @Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/ws").setViewName("/ws"); } } \[/code] \[size=medium]\[color=red]\[b]3.引入依赖包\[/b]\[/color]\[/size] \[code="xml"] net.sourceforge.nekohtml nekohtml 1.9.22 \[/code]