Spring Boot + Vue.js example | Spring Data JPA + REST + MySQL CRUD
Tags: springboot, mysql, vue, springjpa
Published: 2021-04-03 10:39:11

https://grokonez.com/frontend/vue-js/spring-boot-vue-js-example-spring-data-jpa-rest-mysql-crud

Spring Boot + Vue.js example | Spring Data JPA + REST + MySQL CRUD

In this tutorial, we show you Vue.js Http Client & Spring Boot Server example that uses Spring JPA to do CRUD with MySQL and Vue.js as a front-end technology to make request and receive response.

Related Posts:
- <a href="https://grokonez.com/spring-framework/spring-boot/use-spring-jpa-mysql-spring-boot">How to use Spring JPA MySQL | Spring Boot</a>
- <a href="https://grokonez.com/frontend/vue-js/vue-router-example-with-nav-bar-dynamic-route-nested-routes">Vue Router example – with Nav Bar, Dynamic Route & Nested Routes</a>

<!--more-->
<h2>Technologies</h2>
– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.4.RELEASE
– Spring Boot: 2.0.5.RELEASE

- Vue 2.5.17
- Vue Router 3
- Axios 0.18.0
<h2>Overview</h2>
This is full-stack Architecture:

<img src="https://grokonez.com/wp-content/uploads/2018/09/spring-boot-vue-example-spring-data-jpa-rest-api-mysql-architecture.png" alt="spring-boot-vue-example-spring-data-jpa-rest-api-mysql-architecture" width="681" height="243" class="alignnone size-full wp-image-14827" />
<h3>Demo</h3>
<iframe width="853" height="480" src="https://www.youtube.com/embed/MYdTTKq8MCY?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<h3>1. Spring Boot Server</h3>
<img src="https://grokonez.com/wp-content/uploads/2018/09/spring-boot-vue-example-spring-data-jpa-rest-api-mysql-architecture-server.png" alt="spring-boot-vue-example-spring-data-jpa-rest-api-mysql-architecture-server" width="700" height="315" class="alignnone size-full wp-image-14828" />
<h3>2. Vue.js Client</h3>
<img src="https://grokonez.com/wp-content/uploads/2018/09/spring-boot-vue-example-spring-data-jpa-rest-api-mysql-client.png" alt="spring-boot-vue-example-spring-data-jpa-rest-api-mysql-client" width="700" height="334" class="alignnone size-full wp-image-14829" />
<h2>Practice</h2>
<h3>1. Spring Boot Server</h3>
<img src="https://grokonez.com/wp-content/uploads/2018/09/spring-boot-vue-example-spring-data-jpa-rest-api-mysql-project-structure-server.png" alt="spring-boot-vue-example-spring-data-jpa-rest-api-mysql-project-structure-server" width="313" height="369" class="alignnone size-full wp-image-14830" />

- <strong>Customer</strong> class corresponds to entity and table <strong>customer</strong>.
- <strong>CustomerRepository</strong> is an interface extends <strong>CrudRepository</strong>, will be autowired in <strong>CustomerController</strong> for implementing repository methods and custom finder methods.
- <strong>CustomerController</strong> is a REST Controller which has request mapping methods for RESTful requests such as: <code>getAllCustomers</code>, <code>postCustomer</code>, <code>deleteCustomer</code>, <code>findByAge</code>, <code>updateCustomer</code>.
- Configuration for Spring Datasource and Spring JPA properties in <strong>application.properties</strong>
- <strong>Dependencies</strong> for <strong>Spring Boot</strong> and <strong>MySQL</strong> in <strong>pom.xml</strong>


More at: https://grokonez.com/frontend/vue-js/spring-boot-vue-js-example-spring-data-jpa-rest-mysql-crud