spring boot 访问静态资源

spring boot访问静态资源时,直接映射到

classpath:/static

classpath:/public

classpath:/resources classpath:/META-INF/resources

目录下,所以可以直接在这几个目录下放置静态资源即可访问

 

如果需要使用templates,thyleaf模版,首先Spring boot项目需要添加依赖,这样才能找到resource下面的templates下面的*.html文件

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

 

posted @ 2017-11-24 21:12  1367356  阅读(83)  评论(0)    收藏  举报