boweihan / body-shop-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Convenience.

“The state of convenience lies in the hands of proper planning. When you know this, you will become a good planner; and when you become a good planner, you save your life from stress!” - Israelmore Ayivor

basic-spring-boot-server

basic-spring-boot-server presents an opioninated implementation of a generic Java backend. The purpose is to provide a groundwork on which real ideas and applications can be prototyped at break-neck speed. Think of basic-spring-boot-server as a base infrastructure on which you can add YOUR custom business logic.

What's Included?

  • Spring Framework REST implementation and functionality
  • Jetty as our HTTP server
  • Spring Boot Actuator for production metrics and endpoints
  • User/Role basic authentication and authorization
  • Secure field encryption (Bcrypt)
  • Spring Data with Hibernate ORM for data access management
  • Unit tests that run on build
  • DB Seeding
  • Custom exceptions and exception handling
  • Postgres as a database

How do I use it?

basic-spring-boot-server uses gradle as a build tool. First, start by creating a gradle wrapper:

Wrapper: gradle wrapper --gradle-version 2.13

Next, build the project with gradle:

./gradlew build

Lastly, start up your server!

java -jar build/libs/gs-spring-boot-0.1.0.jar

Or execute both commands at once :)

./gradlew build && java -jar build/libs/gs-spring-boot-0.1.0.jar

If this didn't work right away, you might need to configure your local postgres database (next section).

Configuring PostgreSQL to work with basic-spring-boot-server

Local DB configuration can be found in application.yml. Replace the existing properties with your local PostgreSQL config. For example:

url=jdbc:postgresql://localhost:5432/YOUR_DATABASE_NAME
username=YOUR_USERNAME
password=YOUR_PASSWORD

Deployment

basic-spring-boot-server is configured to work with Heroku out of the box. To deploy the application to your Heroku account simply follow the instructions here:

https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku

Base production configurations are set up in application.yml.

Notes

- Server is configured to run on port 8080
- API security management is configured in WebSecurityConfig.java
- On startup, your database will be seeded with an admin user ("admin"/"admin@bsbs.com")

About

License:MIT License


Languages

Language:Java 100.0%