4

Is it a good idea or practice to start a Spring Boot application at production with a following command of Spring Boot Maven plugin ?

mvn spring-boot:run 
alexanoid
  • 24,051
  • 54
  • 210
  • 410
  • 3
    For production that would be a bad idea. That would mean you are directly running your code from your repo on production. Instead of a well tested artifact like a jar or war. – M. Deinum Aug 01 '17 at 06:06
  • 1
    The same question asked in the form of documentation enhancement on GitHub: https://github.com/spring-projects/spring-boot/issues/14395 – fabriziocucci Sep 10 '18 at 17:22

2 Answers2

4

No, this is a bad idea. You would re-build your project on every run which means that you would pull all needed dependencies on each new VM / container.

Also using the spring-boot-maven-plugin in conjunction with the dev-tools for example would lead to options that you don't want in production. This ranges from using other database settings to disabled caching mechanisms for your templating engine.

Use the executable jar instead.

hennr
  • 2,632
  • 2
  • 23
  • 26
0

If you want to run the application with the Maven JVM this is fine.

It is just an alternative way to run your application instead of using the executable jar.

As an alternative you could also start your application with gradle

gradle bootRun

Which is best depends on your circumstance. For live production code I would use a versioned executable jar always.

UserF40
  • 3,533
  • 2
  • 23
  • 34