Coder Social home page Coder Social logo

anupama-sinha / family-asset-management Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 17 KB

A simple standalone RESTful web service application done in Spring Boot framework

Java 100.00%
spring-boot java openapi3 swagger h2-database caching scheduler exception-handling sequence-generator json

family-asset-management's Introduction

Get Started

This is a simple Spring Boot project which discreetly uses below features. Will keep enhancing this project from learning and practice perspective.

OpenApi3 Swagger Documentation

  • Add dependency and @OpenAPIDefinition in main class.
  • Then hit below URL and copy to project and edit accordingly.

http://localhost:8080/v3/api-docs.yaml

  • Then Access Swagger URL below.

http://localhost:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config

H2 In Memory Database

  • In memory Database has been used. It can be accessed below.

http://localhost:8080/h2-console

Caching

  • Spring's default caching has been used in this project for frequently accessed API Endpoints.
  • Once empty, DB not checked until TTL(Time to Live), so perform DB check if empty.
  • Using keys and sync is recommended. Refer further details below

https://www.foreach.be/blog/spring-cache-annotations-some-tips-tricks

Schedulers

  • Have kept scheduler to perform scheduled tasks. Change cron.expression as required.

Global Exception Handler for Controllers

  • Used @RestControllerAdvice to have centralized exception handling across all Controller classes
  • Avoided use of @ResponseStatus which makes code tightly coupled
  • Tomcat Servlet Container redirects to \error by default
  • Always have NoHandlerFoundException for API Endpoints not created so as to segregate it from other issues of Legacy Internal Server Errors
  • MethodArgumentNotValidException for arguments when empty, null or not given. POJO must have @Valid check. Refer this link
  • Common exceptions can be clubbed as Exception Arrays as used in this project

Sequence Generator

  • Used Identity Strategy here with allocation size 25

https://www.objectdb.com/java/jpa/entity/generated

Top Level JSON Arrays

  • Have avoided using direct JSON Arrays in API response. Please find reason below in link.

https://stackoverflow.com/questions/3503102/what-are-top-level-json-arrays-and-why-are-they-a-security-risk

JPA & Hibernate Relationship Mapping

  • One Product is owned by one member - @OneToOne
  • One Member can own multiple Products - @OneToMany
  • Refer Notes

Email/SMS Integration

HateOAS(Hypermedia As The Engine of Application State)

  • In Progress

OpenAPI Swagger Validation

  • In Progress

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

family-asset-management's People

Contributors

anupama-sinha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.