OpenLiberty / ci.maven

Maven plugins for managing Liberty profile servers #devops
Apache License 2.0
130 stars 91 forks source link

Document steps to use dev mode with Spring Boot apps #1143

Open yeekangc opened 3 years ago

yeekangc commented 3 years ago

Document as part of dev mode's documentation how users can work with Spring Boot apps in dev mode today.

https://github.com/ericglau/guide-spring-boot/commit/c8325cb9074bc9baf97968a857940581919038e5

ericglau commented 3 years ago

To use dev mode in a project with a Spring Boot app, the following steps are needed:

  1. Use war packaging type in pom.xml
  2. Remove the <installAppPackages> setting from the liberty-maven-plugin configuration in pom.xml
  3. Extend SpringBootServletInitializer in the main Spring Boot application class (the class that is annotated with @SpringBootApplication)
  4. Remove the springBoot-2.0 feature from server.xml
  5. Use a <webApplication ... element instead of <springBootApplication ... to define your application in server.xml

Then start dev mode as usual with mvn liberty:dev

See https://github.com/ericglau/guide-spring-boot/commit/c8325cb9074bc9baf97968a857940581919038e5 for an example of how to use dev mode with the sample project in Open Liberty's Spring Boot guide