You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-11Lines changed: 23 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,43 @@
1
+
# Springboot Best Practice
2
+
1
3
This is a minimal Spring Boot application built with standard best practices. It includes JWT bearer token authentication via Spring Security, supports auto-reloading .env configuration, and provides clean, self-documented APIs using Swagger/OpenAPI. Designed as a lightweight foundation for scalable, secure RESTful services.
2
4
3
-
### Features
5
+
## Features
6
+
7
+
### ✅ JWT Authentication using Spring Security And Oauth2 Resource Server
4
8
5
-
✅ **JWT Authentication using Spring Security And Oauth2 Resource Server**
6
9
Implements stateless authentication with JSON Web Tokens for robust and secure REST API access control. By fully leveraging Spring Security and the OAuth2 Resource Server capabilities, this approach minimizes complexity and avoids reinventing boilerplate code—ensuring a clean, maintainable, and production-ready security setup.
7
10
8
-
✅ **Token issuance follows RFC 7617 using HTTP Basic Authentication**
Implements token issuance by authenticating clients via HTTP Basic Authentication as defined in RFC 7617. This standard method securely transmits client credentials to the token endpoint, ensuring trusted clients can obtain tokens safely and efficiently.
10
14
11
-
✅ **Secure refresh token handling — blacklists tokens after use or on logout**
15
+
### ✅ Secure refresh token handling — blacklists tokens after use or on logout
16
+
12
17
Implements refresh token revocation by blacklisting used or explicitly revoked tokens to prevent reuse and enhance security.
13
18
14
-
✅ **Environment variable mapping via `.env` to Spring properties**
19
+
### ✅ Environment variable mapping via `.env` to Spring properties
20
+
15
21
Supports reading configuration from a `.env` file and mapping it to Spring's `${...}` placeholders—ideal for managing environment-specific settings. this can be done with dependency [Spring dot-env](https://github.com/paulschwarz/spring-dotenv)
16
22
17
-
✅ **Swagger/OpenAPI docs for clean, self-documented APIs**
23
+
### ✅ Swagger/OpenAPI docs for clean, self-documented APIs
24
+
18
25
Generates interactive API documentation automatically with Swagger UI, making endpoints easy to explore and test.
19
26
20
-
✅ **Maven Spotless for automatic code formatting**
27
+
### ✅ Maven Spotless for automatic code formatting
28
+
21
29
Integrates Maven Spotless plugin to enforce consistent code style and automatically format your code to standard conventions, improving readability and maintainability.
22
30
23
-
✅ **Git commit metadata integration**
31
+
### ✅ Git commit metadata integration
32
+
24
33
Uses `io.github.git-commit-id` dependency to generate `git.properties` at build time, enabling the app to expose Git commit info for version tracking and diagnostics.
25
34
26
-
✅ **Database migration with Flyway**
35
+
### ✅ Database migration with Flyway
36
+
27
37
Includes Flyway dependency with base configuration, initial SQL migration scripts, and Docker Compose setup for seamless database version control and automated schema updates.
28
38
29
-
✅ **Out-of-the-box CORS setup via application properties**
39
+
### ✅ Out-of-the-box CORS setup via application properties
40
+
30
41
CORS configuration can be easily managed through application.properties. Just enable or disable the config
Supports full integration tests using Testcontainers, including auto-configuration with `@ServiceConnection`. This allows isolated, reproducible testing against real services like PostgreSQL or Redis in disposable Docker containers.
42
54
43
55
Perfect as a starter template for any Java backend project!
0 commit comments