Spring Boot Dev Tools Turning them off for production?

前端 未结 3 1173
Happy的楠姐
Happy的楠姐 2021-02-11 19:20

I was reading around a lot about spring dev tools and I have tried them on and they seem pretty cool. However, I don\'t understand how they get enabled / disabled. For instan

3条回答
  •  别那么骄傲
    2021-02-11 20:05

    No, it's turned off automatically.

    From the Spring Boot reference documentation:

    Developer tools are automatically disabled when running a fully packaged application. If your application is launched using java -jar or if it’s started using a special classloader, then it is considered a “production application”. Flagging the dependency as optional is a best practice that prevents devtools from being transitively applied to other modules using your project. Gradle does not support optional dependencies out-of-the-box so you may want to have a look to the propdeps-plugin in the meantime.

    and

    If you want to ensure that devtools is never included in a production build, you can use the excludeDevtools build property to completely remove the JAR. The property is supported with both the Maven and Gradle plugins.

提交回复
热议问题