【问题标题】:Spring-Boot Tomcat ConfigurationSpring-Boot Tomcat 配置
【发布时间】:2014-09-27 00:03:23
【问题描述】:

spring-boot-starter-web 的嵌入式 Tomcat 配置文件在哪里?我想设置 autoDeploy="true" 以对我的 html 文件进行嵌入式 Tomcat 热部署更改。

【问题讨论】:

标签: spring spring-mvc tomcat spring-boot


【解决方案1】:

嵌入式容器没有自动部署的概念(这是适用于已部署的战争文件的容器功能)。如果你只是想在开发时重新加载静态资源,文档在这里:http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-hotswapping

【讨论】:

  • 嗨 Dave,我们的 spring-boot 应用程序 (web) 使用来自外部的挂载路径的静态内容(.html、.jsp、图像、.css 等)。我们注意到,我们的 spring-boot 应用程序仅在该挂载目录中有新的 jsp 文件或其他静态文件时才会反映,我们可以从浏览器中看到更改。但是,如果静态文件已更新,则浏览器在我们重新启动应用程序之前不会反映。除了为 PROD 使用spring-boot-devtools 之外,有没有办法在不重新启动的情况下对其进行配置?我们使用嵌入式tomcat,配置server.tomcat.context.preresources.base=/external/contents/谢谢!
  • 你试过spring.resources.static-locations=file:///path/to/external/contents吗? (我认为server.tomcat.context.preresources.base 在普通的 Spring Boot 应用程序中根本没有做任何事情。也许你调整了它?)
  • 感谢您的回复!让我试试。 spring.resources.static-locations=file:///path/to/external/contents
猜你喜欢
  • 2018-05-22
  • 1970-01-01
  • 2017-08-08
  • 2021-04-30
  • 1970-01-01
  • 2014-01-01
  • 2017-11-24
  • 2017-09-12
  • 2017-07-14
相关资源
最近更新 更多