Run Spring-boot’s main using IDE

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 <your.main.class>
  3. Set Use classpath of module to <*>_test (the test module!)
  4. Ok and Run it!

Leave a Comment