
本文共 3682 字,大约阅读时间需要 12 分钟。
���Spring Boot���������������������������������CSS���������������������jQuery���������������������������������������������������������������Spring Boot���������������������������������������������������������������������������������������������������������������������������������������������������������Spring Boot���������������������������������
1. ���������������������������
Spring Boot������������������������������������������������Web������������������������������WebMvcAutoConfiguration
������������addResourceHandlers()
���������������������������������������������������������
���������������������������������������������������������������������������
- ������������������������������������������������������������������������������������
isAddMappings()
������false
��������������� statically��������������������������� - ������������������������������������������
cachePeriod
������������������������������������������������������������������������������������
���������������������������������������������������������������
/webjars/****
���������������������������JAR������������������������������������jQuery���������/**
������������������������������������������������CSS���JavaScript���������
2. ������������������WebJars������
������������Spring���������������������������������������������webapp
������������������Spring Boot���������������������������������������������������������������������
������WebJars������������������
WebJars������������������Web������������CSS���JavaScript���������������JAR���������������������Spring Boot������������������WebJars������������������������������������������������������������������
- ���������������
- ������WebJars���������������������������������������������������jQuery������
- ���������������Maven������������������
pom.xml
������������org.webjars jquery 3.4.1
3.������Spring Boot���������������������������JAR���������META-INF/resources/webjars
���������������������
3. ������������������������������������
������������������������������������������Spring Boot���������������������������������������������������Spring Boot���������������������������������������
"classpath:/META-INF/resources/""classpath:/resources/""classpath:/static/""classpath:/public/""/:���������������������"
������������������������������������������������"resources"
������bootstrap.js
������������������������������������http://localhost:8080/resources/bootstrap.js
������������
4. ������index.html
������
Spring Boot������������index.html
������������������������������������������������������������������������������������������������������index.html
���������
- ���������������
- ������
src/main/resources/public
���������������������������������������������������index.html
������������ - ������������������������������������������������������
- ������������������������������������������������������
5. ��������� favicon.ico
Spring Boot������������������������������������������favicon.ico
���������������src/main/resources/static/
���������������������favicon.ico
���
- ���������������
- ���������
.ico
������������������������favicon.ico
���������������������src/main/resources/static/
������ - ������Spring Boot������������������������������������������������������������
6. ������������������������������������
���application.properties
���������������������������������������������������������������������������������������������������������������������������
# ���������������������������������������������������������������������������������spring.resources.static-locations=classpath:/dir01/,classpath:/dir02/
������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
