1. 程式人生 > >springboot整合 thymeleaf

springboot整合 thymeleaf

pom

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

application.yml

spring:
    thymeleaf:
          prefix: classpath:/templates/
          check-template-location: true
          suffix: .html
          encoding: UTF-8
          content-type: text/html
          mode: HTML5
          cache: false

StringbootApplication 類

public class StringbootApplication extends SpringBootServletInitializer {
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(StringbootApplication.class);
	}

	public static void main(String[] args) {
		SpringApplication.run(StringbootApplication.class, args);
	}
}