默认配置
新建一个index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>静态文件测试</title>
</head>
<body>
SpringBoot的静态资源
</body>
</html>
SpringBoot默认可以识别的路径:
- resources/static/下
- resources/public/下
- resources/resources/下
- resources/META-INF/resources/下
手动配置路径
注意要保留原先的静态资源路径
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,classpath:/mydir