如何阻止Tomcat重新启动?

时间:2021-07-31 12:01:08

标签: spring-boot tomcat7

在Spring boot应用程序中如何阻止tomcat一次又一次地重新启动 代码已更改。

谢谢 苏尼尔

2 个答案:

答案 0 :(得分:1)

此依赖项可能位于您的 POM.xml 中:

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <scope>runtime</scope>
      <optional>true</optional>
</dependency>

它完全用于您所描述的行为,在开发过程中“无需手动重启服务器”。

它会自动禁用,不会出现在生产版本中。

如果您不喜欢它,只需从 POM.xml 中删除依赖项并加载 maven 更改。

您的 IDE 中可能还有一些设置可以暂时关闭此行为。如果您使用 IntelliJ

  • 下:File->settings->build,execution,deployment->compiler

    自动关闭项目的构建

或:

  • Ctrl+SHIFT+A->registry

    关闭compiler.automake.allow.when.app.running

EclipseSpring 工具套件中:

  • 下:Project

    取消选中 Build Automatically

答案 1 :(得分:1)

问题可能是因为您在 pom.xml 中添加的 devtools。

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

只需删除此依赖项并更新项目即可。

另一种解决方案是,如果您使用 Eclipse 或 spring 工具套件,则可以取消选中此选项

SpringToolSuite

相关问题