Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where and how to deploy a Java Spring Boot application for free? [closed]

I want to know where and how can I deploy a Java web application made with Spring Boot or an app built with servlets or JSP.

Consider me a beginner in this topic. If you have suggestions about what I should learn first in order to accomplish this then please share, also if you have any links to particularly helpful blogs or videos that will do too.

Thank you all in advance.

like image 461
Dev Avatar asked Apr 24 '20 10:04

Dev


People also ask

How do you shutdown a spring boot application in a correct way?

In the Spring Boot Document, they said that 'Each SpringApplication will register a shutdown hook with the JVM to ensure that the ApplicationContext is closed gracefully on exit. ' When I click ctrl+c on the shell command, the application can be shutdown gracefully.

How do I host a spring boot on github?

Open a terminal window. Create a local directory to hold your Spring Boot application by typing mkdir SpringBoot. Change to that directory by typing cd SpringBoot . Clone the Spring Boot Getting Started sample project into the directory you created by typing git clone https://github.com/spring-guides/gs-spring-boot.


2 Answers

I too have used GCP to host a Spring-Boot service. I followed this article almost religiously provided by Spring Boot(https://www.baeldung.com/spring-boot-google-app-engine) as well as this github read me that includes extra information about preparing your service to be hosted onto GCP (https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/appengine-standard-java8/springboot-appengine-standard)

  • The main idea is that you will need to create a CLOUD SQL instance if you are using MySQL, and then add some configurations in your applications.properties (https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory)
  • You will need to package your Spring-Boot services to either a jar or a war. I used a war because I was able to find more resources. This is done in your pom.xml.
  • You will need to include all the right GCP packages to be able to host onto gcp in your pom.xml
  • You will need to create some sort of runtime configuration by creating an appengine/app.yaml file
  • You will need to extend a Servlet class in your main application file so that GCP has a main endpoint when any call is made to utilize your Spring-Boot services
like image 181
frlzjosh Avatar answered Oct 13 '22 19:10

frlzjosh


You can use GCP (google cloud platform) App Engine for the deployment purpose. It's easy to learn and free to use for 1 year.

Deploy Spring Boot Application in App Engine standard

like image 44
Saurav Kumar Singh Avatar answered Oct 13 '22 18:10

Saurav Kumar Singh