Skip to content

Example of REST API using SpringBoot with JPA, Hibernate, Swagger, Maven, Flyway, MySQL, H2 testing, etc.

Notifications You must be signed in to change notification settings

mikebryantky/SpringBootExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpringBoot Proof of Concept

Codeship Status for mikebryantky/SpringBootExample

SpringBoot

  • Make a copy of the application-development-sample.yaml named application-development.yaml
  • Edit the application-development.yaml file so that the db_name, user, and passwords match your environment.
  • Make a copy of the application-test-sample.yaml named application-test.yaml
  • Edit the application-test.yaml file so that the db_name, user, and passwords match your environment.

MySQL

NOTE: Be sure that that empty database schema is created prior to running. Flyway migrations will not create MySQL databases.

Example:

CREATE DATABASE dbname
  CHARACTER SET utf8
  COLLATE utf8_general_ci;

To create a backup of the MySQL database, run:

mysqldump --complete-insert --lock-all-tables --extended-insert=false --default-character-set=utf8 -uxxUSERxx -pxxPASSxx dbname | gzip -9 > dbname.sql.gz

Maven

  • To clean: mvn clean
  • To build: mvn package -Dspring.profiles.active=test
  • To run: mvn spring-boot:run -Dspring-boot.run.profiles=development (app runs at http://localhost:8080/)
  • To run unit tests: mvn test -Dspring.profiles.active=test

Actuator

Note: You must be logged before accessing any actuator endpoints.

See here for a full list of actuator endpoints.

Swagger

To access Swagger documentation, while running the app go to http://localhost:8080/swagger-ui.html

Misc

  • To deploy, run:
sudo java -Dspring.profiles.active=production -jar ./target/poc-0.0.1-SNAPSHOT.jar &

To-Do

About

Example of REST API using SpringBoot with JPA, Hibernate, Swagger, Maven, Flyway, MySQL, H2 testing, etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published