我的基于 TomcatEmbeddedServletContainer 的 Spring Boot 应用程序
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
MVC Controller :
@Controller
@EnableWebMvc
public class JspController {
@RequestMapping("/home")
public String home(ModelAndView modelAndView) {
return "home";
}
}
问题是当我运行应用程序时临时文件位于哪里?我遇到了重新运行应用程序后并不总是应用我的更改的问题...请帮助弄清楚如何在应用程序运行时获取最新的代码版本。
最佳答案
通过从Spring Boot Actuator发送刷新
请求解决了这个问题列表。
POST /refresh HTTP/1.1
Host: localhost:8080
Cache-Control: no-cache
它会重新加载 Spring Boot 应用程序的所有静态和非静态组件。 要查看所有可用的执行器请求,请导航至 http://localhost:8080/actuator .
要在应用程序上使用执行器,您只需添加 spring-boot-starter-actuator
maven 依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
关于java - 使用默认配置的 Spring Boot 应用程序的文件位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36293946/