Spring Boot: Heroku
Running Spring Boot Applications On Heroku
To run a Spring Boot application on Heroku:
-
If you are using the
heroku-maven-plugin
be sure that the<web>
element includes setting the port number to the one that Heroku wants the application to run on. In the example below,jar-file-name-1.0
is just an example. It should actually match the name of the jar file created by yourpom.xml
. It’s the--server.port=$PORT
that you are more likely to be missing.<processTypes> <web>java $JAVA_OPTS -jar target/jar-file-name-1.0.jar --server.port=$PORT</web> </processTypes>
-
Similarly, if you are using the
Procfile
to start up the application by automatically deploying a branch from the Heroku dashboard, then you’ll need to be sure theProfile
contains the--server.port=$PORT
flag, e.g.
See also
- Heroku’s Documentation for Spring Boot: https://devcenter.heroku.com/articles/deploying-spring-boot-apps-to-heroku
- DZone documentation for Spring Boot on Heroku: https://dzone.com/articles/spring-boot-heroku-and-cicd
More on Spring Boot: Heroku
- Spring Boot: Ajax—Communicating between front-end JavaScript and backend Java using XMLHTTP requests
- Spring Boot: Annotations—The various things starting with @ that are particular to Spring and Spring Boot
- Spring Boot: Command Line—A Command Line program within the Spring Boot framework
- Spring Boot: Configuration—The src/resources/application.yml file, and how to fix 'Could not resolve placeholder ${salt}' type errors
- Spring Boot: Controllers—The component where you map routes to the model and view
- Spring Boot: Example Projects—Links to various Spring Boot Projects of interest
- Spring Boot: Heroku—Running Spring Boot Applications On Heroku
- Spring Boot: HTTPS—Enabling HTTPS
- Spring Boot: Logging—How to handle logging in Spring Boot
- Spring Boot: main—What the main program looks like in a Spring Boot Application
- Spring Boot: OAuth—Social login with Spring Boot
- Spring Boot: Starter Parent—What does the `parent` section in the pom.xml do?