gpt4 book ai didi

java - Spring 引导 devtools : how to exclude java classes from restarting the application?

转载 作者:搜寻专家 更新时间:2023-11-01 02:37:38 25 4
gpt4 key购买 nike

在 Intellij IDEA 中,在 maven 配置中激活 spring-boot-devtools,我可以轻松更新静态 Web 组件,并且 javascript 或 html 代码更新很容易反射(reflect)在正在运行的应用程序中。

缺点是我的 java 类也会重新加载。这是我想避免的事情,因为我有一些繁重的类(class),加载时间长达两分钟。

如何配置 spring-boot-devtools 例如静态 Web 组件重新加载,但服务器没有完全重新启动(以便我的 Java 类成员变量保持不变)?

最佳答案

如果您只想从自动静态资源刷新中受益,您可以通过将 Spring Boot 属性 spring.devtools.restart.enabled 设置为 false 来禁用 devtools 重启功能>.

20.2.3 Disabling restart

If you don’t want to use the restart feature you can disable it using the spring.devtools.restart.enabled property. In most cases you can set this in your application.properties (this will still initialize the restart classloader but it won’t watch for file changes).

Here is the documentation reference .

关于java - Spring 引导 devtools : how to exclude java classes from restarting the application?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43436194/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com