多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
**1. SpringBoot中默认的静态资源位置** ```java public class ResourceProperties { private static final String[] CLASSPATH_RESOURCE_LOCATIONS = new String[] { "classpath:/META-INF/resources/" /resources/META-INF/resources/ , "classpath:/resources/" /resources/resources/ , "classpath:/static/" /resources/static/ , "classpath:/public/" /resources/public/ }; private String[] staticLocations; private boolean addMappings; ``` **2. `pom.xml`引入devtools** ```html <!-- 热重启组件,它对于静态资源的访问尤为重要 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> ``` **3. 静态资源默认放在`resources/static`目录下** ``` |—— 项目名 | |—— src | | |—— main | | | |—— java | | | |—— resources | | | | |—— static #放一些静态资源,js、css、图片等 | | | | | |—— assets | | | | | | |—— jquery.min.js | | | | |—— templates | | | | | |—— account.html ``` **4. 页面引入jquery** ```html <script type="text/javascript" src="/assets/jquery.min.js"></script> ```