GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - raeperd/realworld-springboot-java: Spring boot java implementation of realworld example.app

BranchesTags
Open more actions menu

Latest commit

 

History

202 Commits
202 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
doc
doc
 
 
gradle/wrapper
gradle/wrapper
 
 
src
src
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.sdkmanrc
.sdkmanrc
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
realworld.drawio
realworld.drawio
 
 
settings.gradle
settings.gradle
 
 
test.gradle
test.gradle
 
 

Repository files navigation

RealWorld example apps cover Build License: MIT

ReadWorld.io backend project using spring boot java using spring-security, spring-data-jpa

Insprired by

  • 우아한형제들 기술 불로그 | Todo list 만들기는 이제 그만
  • 우아한형제들 기술 블로그 | Gradle 프로젝트에 JaCoCo 설정하기
  • 우아한형제들 기술 블로그 | 우린 Git-flow를 사용하고 있어요
  • Github | Realworld.io

Getting started

Build from scratch

$ ./gradlew build bootRun

Using docker

$ docker run --rm -p 8080:8080 ghcr.io/raeperd/realworld-spring-boot-java:main
  • Dockerhub registry is here
  • Container tags are simply branch name of this repository following git-flow strategy

How to test

After run application, you can try one of followings

using shell script

$ ./doc/run-api-tests.sh

using postman

Import ./doc/Conduit.postman_collection.json in your postman application

And also, pure gradle test covers almost every line of code.

More details can be found in ./doc/README.md and original source

Overview

Design Principal

  • Always final whenever possible
  • Always package private class whenever possible
  • Always test every package, class, method, instruction in codes
    • Except for some boilerplate equals and hashcode method
    • This is validated by jacoco-gradle-plugin.
    • Coverage verification in ./test.gradle
  • Try to avoid including additional dependencies as much as possible
    • Implements JWT generation / validation logic without 3rd party library #3
  • Try to maintain codes in domain package remain POJO
    • Except for special spring annotations like @Service, @Repository, @Transactional
    • Prohibit use of lombok in domain package
  • Try to follow all modern best practices for spring-boot project

Diagrams

  • You can open full diagram file in realworld.drawio using draw.io

User

realworld-User

  • Separate password encoding logic out of User.
  • User must be created with password encoder.

Article

realworld-Article

  • Article contains other elements with @Embedded classes
  • Try to reduce number of repositories.
  • Prefer @JoinTable to @JoinColumn

JWT

realworld-Jwt

  • Try not to use 3rd party library
  • Serialization and Deserialization are seperated with interfaces
  • Domain package contains interface, infrastructure code provide implementation
  • Application package do stuff with spring-security logic

Performance

Result of ./doc/run-api-tests.sh, run 100 times for each version.

Version Runs Requests Failures Avg response time P50 P90 P95 P99 Max Avg full run duration
Before Spring Boot 4 upgrade (d9c19f1) 100 3100 0 21.64ms 6.0ms 113ms 123ms 137ms 188ms 16.848s
After Spring Boot 4 upgrade (18432fa) 100 3100 0 21.10ms 6.0ms 115ms 119ms 131ms 233ms 16.866s
Java 25 with virtual threads 100 3100 0 20.31ms 6.0ms 104ms 116ms 128ms 210ms 16.765s

Java 25 with virtual threads is not meaningfully slower than the Java 17 baseline. Average response time and tail latency were slightly better in this local run.

What can be done more

  • User class doing so many things now. It can be improved someway.
  • Service classes can be divided into smaller services
  • Test cases order can be improved

Contact

You can contact me with email or issue in this project

License

MIT License

Referenced

  • JSON Web Token Introduction - jwt.io
  • Symmetric vs Asymmetric JWTs. What is JWT? | by Swayam Raina | Noteworthy - The Journal Blog
  • presentations/auth.md at master · alex996/presentations · GitHub

About

Spring boot java implementation of realworld example.app

Topics

github-actionjacoco-pluginjava11jib-gradlelombok-gradlesonarcloudspring-bootspring-data-jpa

Resources

Readme
MIT license
Activity

Stars

240 stars

Watchers

2 watching

Forks

98 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.