> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/ix.-how-to-guides/85.-hot-swapping/85.1-reload-static-content.md).

# 85.1 重新加载静态内容

Spring Boot有很多用于热加载的选项，不过推荐使用[spring-boot-devtools](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#using-boot-devtools)，因为它提供了其他开发时特性，比如快速应用重启和LiveReload，还有开发时敏感的配置加载（比如，模板缓存）。Devtools通过监控类路径上的变化工作。这意味着静态资源的改变必须“生成”才能生效。默认的，当你保存你的改变时，这在Eclipse里会自动发生。在IntelliJ IDEA里，生成项目命令会触发必要的构建。由于[默认的重启排除](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#using-boot-devtools-restart-exclude)，静态资源的改变将不会触发应用的重启。但是，它们会触发LiveReload。

此外，使用IDE开发也是一个不错的方式，特别是需要调试的时候（所有的现代IDEs都允许重新加载静态资源，通常也允许对变更的Java类进行热交换）。

最后，[Maven和Gradle插件](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#build-tool-plugins)也支持命令行下的静态文件热加载。如果你使用其他高级工具编写css/js，并使用外部的css/js编译器，那你就可以充分利用该功能。
