Skip to content

Blog application using Spring Boot with Java, PostgreSQL database that has association, authentication and authorization with spring security and jwt , jUnit 5 and much more.

Notifications You must be signed in to change notification settings

badripaudel77/blogs-web-service-spring-boot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

amigos-spring-blogs

Blog application using Spring Boot & Java

TODO: please add redis with spring redis .... for learning purposes and observe the time efficiency for retrieving data.

Dependencies :

  • Spring web
  • Spring boot dev tools
  • Data JPA
  • Hibernate validator
  • PostgreSQL Driver
  • Spring Security & More...

Architecture followed

  • MVC

Project Structure

  • apis -> contains all the rest endpoints [equivalent to resources in grails]
  • services -> contains business logic that are not really connected to the view
  • models -> contains all the domain class [data class to map to database]
  • repositories -> contains all the spring data repositories for data access
  • configuration -> contains all relevant configuration files for the app.
  • utils -> contains all the utilities classes & methods for additional logic
  • dtos -> data transfer objects [ to transfer data / map entity to reponse , just like in grails]
  • exceptions -> contains all the classes for handling exception for the application
  • ....

Database

  • users [will contain all users, individual users will have many blogs]
  • blogs [contains all the blog posts, blog will contain the user_id]
  • comments [one blog has many comments, comment has blog_id & user_id, one user can make multiple comments?]
  • roles [role defined for each user, like ADMIN_ROLE, NORMAL_USER, and more if required.]
  • categories [list of categories, one post can have categories...]

Spring security reference :

Spring boot image [file] uploading & serving [image] download url

JWT authentication

JUnit Testing

  • If we include spring boot testing , it by default includes assertJ, Junit etc.
  • REF : https://junit.org/junit5/docs/current/user-guide/ [JUnit 5]
  • REF : AssertJ library [provides very good methods for assertion ] https://assertj.github.io/doc/
  • To test with different database for eg : H2 in memory database, we can create resources folder inside the test and create a separate application.properties file there and testing will use that folder.

About

Blog application using Spring Boot with Java, PostgreSQL database that has association, authentication and authorization with spring security and jwt , jUnit 5 and much more.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages