1. Clone the application
https://github.com/corasaniti/spring-boot-rest-api-tutorial.git
2. Create Mysql database
create database spring_rest_demo
3. Change mysql username and password as per your installation
-
open
src/main/resources/application.properties
-
change
spring.datasource.username
andspring.datasource.password
as per your mysql installation
4. Build and run the app using maven
Build With Maven command
mvn package
Alternatively you can use batch file to clean and build application
- set
M2_HOME
andJAVA_HOME
inbuild.properties
- execute
clean.bat
- execute
build.bat
Launch Application with
java -jar target/spring-boot-rest-demo-0.0.1-SNAPSHOT.jar
5. Run Without Build
You can run the app without packaging it using -
mvn spring-boot:run
The app will start running at http://localhost:8080.
The app defines following CRUD APIs.
GET /api/v1/users
POST /api/v1/users
GET /api/v1/users/{userId}
PUT /api/v1/users/{userId}
DELETE /api/v1/users/{userId}