Run Spring-boot's main using IDE

前端 未结 9 1972
灰色年华
灰色年华 2020-11-30 01:51

I have a spring-boot application that needs to:

  • Be deployable as a war in a servlet container
  • Be runnable via `mvn spring-boot:run``

I\

9条回答
  •  忘掉有多难
    2020-11-30 02:26

    A workaround that is strongly inspired from https://youtrack.jetbrains.com/issue/IDEA-140041 is to start your main class with the test classpath (which includes the embedded servlet.)

    Steps (IntelliJ 16):

    1. Run -> Edit Configurations -> Add new configuration -> Pick Application type.
    2. Set Main class to
    3. Set Use classpath of module to <*>_test (the test module!)
    4. Ok and Run it!

提交回复
热议问题