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>

本博客为非营利性个人原创,除部分有明确署名的作品外,所刊登的所有作品的著作权均为本人所拥有,本人保留所有法定权利。违者必究
浙公网安备 33010602011771号