0% found this document useful (0 votes)
2 views2 pages

SpringBoot MySQL Deployment Guide

This document provides a step-by-step guide to create a Spring Boot application with MySQL, Docker, and deployment on Render. It covers project setup, CRUD app creation, MySQL configuration, Docker support, GitHub integration, and deployment testing. The guide emphasizes using Railway for cloud MySQL and includes necessary code snippets and commands.

Uploaded by

Naveen Naveen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

SpringBoot MySQL Deployment Guide

This document provides a step-by-step guide to create a Spring Boot application with MySQL, Docker, and deployment on Render. It covers project setup, CRUD app creation, MySQL configuration, Docker support, GitHub integration, and deployment testing. The guide emphasizes using Railway for cloud MySQL and includes necessary code snippets and commands.

Uploaded by

Naveen Naveen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Spring Boot + MySQL + Docker + Render Deployment Guide

Step 1: Create Spring Boot Project

- Use https://start.spring.io

- Dependencies: Spring Web, Spring Data JPA, MySQL Driver

- Java version: 17

Step 2: Build Your CRUD App

- Create User.java (model with fields, getters/setters)

- Create UserRepository.java (JPA Repository)

- Create UserController.java (CRUD REST API endpoints)

Step 3: Configure MySQL Connection

- In application.properties:

- spring.datasource.url=jdbc:mysql://<host>:<port>/<db>

- spring.datasource.username=<username>

- spring.datasource.password=<password>

- spring.jpa.hibernate.ddl-auto=update

Step 4: Set Up Cloud MySQL (Railway)

- Go to https://railway.app

- Create project -> Provision MySQL

- Copy DB credentials and use in application.properties

Step 5: Add Docker Support

- Create Dockerfile with multi-stage build

- Use Maven image to build .jar, then run with JDK image

Step 6: Push Project to GitHub

- git init

- git add .

- git commit -m 'Initial commit'

- git remote add origin <your-repo-url>

- git push -u origin main

Step 7: Deploy on Render

- Go to https://render.com

- Create new Web Service and connect GitHub


- Choose Docker runtime, set port 8081

Step 8: Test Everything

- Use browser, frontend, or Postman to test:

- GET /users, POST /users, PUT /users/{id}, DELETE /users/{id}

- Data is saved and fetched from Railway MySQL

You might also like