{"id":24251476,"url":"https://github.com/arafkarsh/ms-springboot-vanilla","last_synced_at":"2025-07-30T08:05:55.772Z","repository":{"id":271195034,"uuid":"865770177","full_name":"arafkarsh/ms-springboot-vanilla","owner":"arafkarsh","description":"Microservice: Java 17, 23, SpringBoot 3.4.1, \u0026 Jakarta EE 10. NFRs - Spring AOP, Exception, Logging, Micrometer, Open Telemetry, Crypto, AES Encryption for DB Passwords,  and Spring Security, JWT, KeyCloak, Alpine/Alpaquita Multi-Architecture Containers, Kubernetes, Swagger API Docs.","archived":false,"fork":false,"pushed_at":"2025-02-05T12:07:54.000Z","size":23308,"stargazers_count":46,"open_issues_count":0,"forks_count":17,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T21:06:53.667Z","etag":null,"topics":["alpine","container","docker","jakarta-ee","jakartaee10","java23","jwt","keycloak","kubernetes","micrometer","opentelemetry","otel-agent","otel-collector","prometheus","spring-aop","spring-boot","spring-security","springboot334","springboot341","ubuntu"],"latest_commit_sha":null,"homepage":"https://www.arafkarsh.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arafkarsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-01T05:24:39.000Z","updated_at":"2025-04-02T19:21:54.000Z","dependencies_parsed_at":"2025-01-14T10:45:29.515Z","dependency_job_id":null,"html_url":"https://github.com/arafkarsh/ms-springboot-vanilla","commit_stats":null,"previous_names":["arafkarsh/ms-springboot-vanilla"],"tags_count":0,"template":true,"template_full_name":"arafkarsh/ms-springboot-324-java-22-jakarta-ee-10","purl":"pkg:github/arafkarsh/ms-springboot-vanilla","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arafkarsh%2Fms-springboot-vanilla","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arafkarsh%2Fms-springboot-vanilla/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arafkarsh%2Fms-springboot-vanilla/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arafkarsh%2Fms-springboot-vanilla/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arafkarsh","download_url":"https://codeload.github.com/arafkarsh/ms-springboot-vanilla/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arafkarsh%2Fms-springboot-vanilla/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267834756,"owners_count":24151638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpine","container","docker","jakarta-ee","jakartaee10","java23","jwt","keycloak","kubernetes","micrometer","opentelemetry","otel-agent","otel-collector","prometheus","spring-aop","spring-boot","spring-security","springboot334","springboot341","ubuntu"],"created_at":"2025-01-15T02:50:56.363Z","updated_at":"2025-07-30T08:05:55.738Z","avatar_url":"https://github.com/arafkarsh.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloud-Native Architecture / Microservice Template\n## Non Functional Requirements Template\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=arafkarsh_ms-springboot-334-vanilla\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=arafkarsh_ms-springboot-334-vanilla) \n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=arafkarsh_ms-springboot-334-vanilla\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=arafkarsh_ms-springboot-334-vanilla)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=arafkarsh_ms-springboot-334-vanilla\u0026metric=code_smells)](https://sonarcloud.io/summary/new_code?id=arafkarsh_ms-springboot-334-vanilla) \n[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=arafkarsh_ms-springboot-334-vanilla\u0026metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=arafkarsh_ms-springboot-334-vanilla)\n\n1. Java 23 (Minimum Requirement: Java 17)\n2. SpringBoot 3.4.1\n3. Jakarta EE 10 \n\nCloud-native (or microservice) architecture is an approach to application design in which software is \nbroken down into small, independent services that communicate through lightweight APIs, enabling \nmore agile development, scalability, and resilience. Rather than running a single monolithic codebase, \neach microservice can be developed, deployed, and scaled independently. \n\nThis decomposition—often containerized and orchestrated using tools such as Kubernetes—allows teams \nto quickly iterate on features, take advantage of cloud-native capabilities (like auto-scaling and \nautomated deployments), and release updates with minimal disruption to the entire system. According \nto the Cloud Native Computing Foundation (CNCF), this approach fosters loosely coupled systems that \nare resilient, manageable, and observable, combined with robust automation (CNCF, 2023).\n\nKey Features of Microservice (Sources: CNCF, 2023; Fowler, 2014):\n\n1.\tService Independence: Each microservice is autonomous, allowing for separate development, deployment, and scaling without affecting others.\n2. Containerization: Services are commonly packaged in containers (e.g., Docker), providing consistency across different environments and efficient resource utilization.\n3.\tLightweight Communication: Microservices communicate via lightweight protocols (often HTTP/REST or gRPC), reducing overhead and complexity.\n4.\tScalability: Independent scaling of services ensures you can allocate resources exactly where needed, improving performance and cost-efficiency.\n5.\tContinuous Delivery and Deployment: Automation enables frequent, reliable releases to production while minimizing disruption.\n6.\tResilience: Failure of one service doesn’t necessarily bring the entire system down, as microservices are loosely coupled and can handle faults gracefully.\n\nReferences\n\n- CNCF. (2023). What is Cloud Native? https://www.cncf.io/blog/2023/02/03/what-is-cloud-native/ \n- Fowler, M. (2014). Microservices. https://martinfowler.com/articles/microservices.html\n\n## What the Template Provides out of the box\n\n1. Security Auth/Authorization using AOP and Filters\n2. Exception Handling with Exception Framework using AOP ( ..microservice.adapters.aop)\n3. Log Management using AOP (json and text formats) using Logback  (...adapters.filters)\n4. Standardized REST Responses (...domain.models.StandardResponse)\n5. Security using JWT Tokens / KeyCloak Auth (...microservice.adapters.security, ...microservice.security)\n6. Encrypting Sensitive Data using Encryption Algorithms (...microservice.security)\n7. JPA configurations for H2 and PostgreSQL (...server.config)\n8. Observability Using Micrometer, Prometheus and Open Telemetry.\n9. Database Password Encryption using Jasypt. Checkout the shell programs encrypt and decrypt.\n10. Digital Signatures using Standard Java Cryptography.\n11. Open API based Swagger API Docs (...microservice.adapters.controllers)\n\n## How to Setup and use the template\n\n### Encrypting Database Passwords for the Property Files\n\nThis microservice template offers a range of built-in functionalities. To simplify the demonstration of \nvarious features, an encrypted password is utilized for connecting to H2 and PostgreSQL databases. \nThe template includes utilities for encrypting and decrypting passwords, ensuring that the encryption \nkey is securely stored outside the application’s runtime context.\n\nTo know more about how to setup these passwords (for H2 \u0026 PostgreSQL) and environment variables\ncheckout Session 1.2\n\nEncrypted H2 (In Memory) Database Password. Uses H2 database in Dev (Profile) mode.\n![Package Structure](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/encrypt/Security-H2-psd.jpg)\nEncrypted PostgreSQL Database Password. Uses PostgreSQL DB in Staging \u0026 Prod (profile) mode.\n![Package Structure](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/encrypt/Security-PostgreSQL-psd.jpg)\nPassword can be decrypted only using an Encryption Key stored in System Enviornment variable\n![Package Structure](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/encrypt/Security-Encryption-pro.jpg)\n\nIf the Quality Gate check fails, it's because the password is encrypted within the application’s \nproperties file, with the encryption key stored externally, outside the application’s context.\n\nHowever, quality standards mandate that passwords should be securely stored in a vault, such as\nHashiCorp Vault, for enhanced security.\n\n### Microservice Package Structure\n\n![Package Structure](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/MS-Pkg-Structure.jpg)\n\nio.fusion.air.microservice\n1. adapters (All the Implementations from App/Service perspective)\n2. domain (All Entities, Models, Interfaces for the implementations)\n3. security (All Security related modules)\n4. server (Managing the Service - from a server perspective, Setups (Cache, DB, Kafka etc, Configs)\n5. utils (Standard Utilities)\n\n### Security Framework with Spring Security, JWT, KeyCloak, \u0026 Cryptography\n![Security Structure](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/Fusion-Security-Pkg.png)\n\n1.\tAdapters Package (left side) – Integrations with Spring MVC, AOP, Filters, and Web Security.\n2. Security Package (right side) – Core libraries and utilities for JWT creation, validation, cryptography, etc.\n\n#### 1. Adapters Package (io.fusion.air.microservice.adapters)\n\nA. Filters Package\n1.\tJWT Auth Filter\n- A javax.servlet.Filter (or jakarta.servlet.Filter) that intercepts requests early in the servlet chain.\n- It extracts JWTs from headers, validates or parses them, and stores user claims in a ClaimsManager for downstream use.\n2.\tLog Filter\n- Another servlet filter for logging requests. Possibly logs details like request URIs, IP addresses, timings, etc.\n3.\tSecurity Filter\n- A filter that enforces security rules at the servlet layer (e.g., blocking requests with invalid data or applying firewall rules).\n- Complements or replaces Spring Security’s default filter chain in some scenarios.\nThese filters run before the DispatcherServlet. They can reject or manipulate requests if authentication or security checks fail.\n\nB. Spring Framework (DispatcherServlet)\n- DispatcherServlet is the central Spring MVC component that routes incoming HTTP requests to the\n  appropriate controller endpoints. Checkout the [API flow in Part 4 of my Java 23 series.](https://arafkarsh.medium.com/java-23-springboot-3-3-4-api-flow-logging-part-4-1000546bcd62) \n\nC. AOP Package\n- Authorization Request Aspect\n- A Spring AOP aspect that intercepts controller or service methods to enforce authorization rules.\n- Typically checks whether the user has the necessary roles/permissions based on JWT claims or\n  custom annotations (@AuthorizationRequired).\n\nCheckout the [Java 23, SpringBoot 3.3.4, \u0026 Jakarta EE 10](https://arafkarsh.medium.com/java-23-springboot-3-3-4-jakarta-10-125bc815d6c1) \nfor more details on this topic.\n\n### Template Tutorials - Java 23, SpringBoot 3.3.4 \u0026 Jakarta 10 Series\n1. [Java 23, SpringBoot 3.3.4 \u0026 Jakarta 10 — Part 1](https://arafkarsh.medium.com/java-23-springboot-3-3-4-jakarta-10-125bc815d6c1)\n2. [Java 23, SpringBoot 3.3.4: AOP Exception Handling — Part 2](https://arafkarsh.medium.com/java-23-springboot-3-3-4-aop-exception-handling-part-2-e6adc86c8a26)\n3. [Java 23, SpringBoot 3.3.4: Logback Setup — Part 3 ](https://arafkarsh.medium.com/java-23-springboot-3-3-4-logback-setup-part-3-c2ffe2d0a358)\n4. [Java 23, SpringBoot 3.3.4: Log/Events: API Flow \u0026 Logging — Part 4](https://arafkarsh.medium.com/java-23-springboot-3-3-4-api-flow-logging-part-4-1000546bcd62)\n5. [Java 23, SpringBoot 3.3.4: Metrics: Micrometer, Prometheus, Actuator — Part 5](https://arafkarsh.medium.com/java-23-springboot-3-3-4-metrics-micrometer-prometheus-actuator-part-5-f67f0581815c)\n6. [Java 23, SpringBoot 3.3.4: Metrics: Micrometer \u0026 AOP — Part 6](https://arafkarsh.medium.com/java-23-springboot-3-3-4-metrics-micrometer-aop-part-6-808dcb97dcb7)\n7. [Java 23, SpringBoot 3.3.4: Tracing: OpenTelemetry — Part 7](https://arafkarsh.medium.com/java-23-springboot-3-3-4-tracing-opentelemetry-part-7-937df4867c9c)\n8. Java 23, SpringBoot 3.4.1: Tracing: OpenTelemetry Zero Code— Part 8 Coming Soon\n9. [Java 23, SpringBoot 3.4.1: Containers: Alpine Multi-Architecture — Part 9](https://arafkarsh.medium.com/java-23-springboot-3-4-1-multi-architecture-containers-part-9-b8c70ed3842f)\n10. [Java 23, SpringBoot 3.4.1: Containers: Kubernetes — Part 10](https://arafkarsh.medium.com/java-23-springboot-3-4-1-kubernetes-containers-part-10-1b3b3b3b1b1b)\n11. Java 23, SpringBoot 3.4.1: Filters: Security, Log — Part 11 Coming Soon\n12. Java 23, SpringBoot 3.4.1: AOP: Spring Security — Part 12 Coming Soon\n13. Java 23, SpringBoot 3.4.1: Security: JSON Web Token — Part 13 Coming Soon\n14. Java 23, SpringBoot 3.4.1: CRUD : Domain Driven Design — Part 14 Coming Soon\n15. Java 23, SpringBoot 3.4.1: CRUD Queries \u0026 Page Sort — Part 15 Coming Soon\n\n### Pre-Requisites\n\n1. SpringBoot 3.3.4\n2. Java 23 (Minimum Requirement Java 17)\n3. Jakarta EE 10 (jakarta.servlet.*, jakarta.persistence.*, javax.validation.*)\n4. Maven 3.8.6\n5. Git 2.31\n\n## 1. Setting up the Template\n\n### Step 1.1 - Getting Started\n\n1. git clone [https://github.com/arafkarsh/ms-springboot-334-vanilla](https://github.com/arafkarsh/ms-springboot-334-vanilla)\n2. cd ms-springboot-334-vanilla\n\n###  Step 1.2 - Setup Encrypted DB Password in Property files\n\n#### 1.2.1 Encrypt the Database passwords for H2 and PostgreSQL \n\nIf you dont encrypt the password with your Encryption Key it will throw an exception saying unable to decrypt the password.\nHere are the steps to encrypt the password.\n\nRun the follwing command line option\n```\n$ source encrypt your-db-password your-encrypton-key\n```\n![Passowrd-Gen](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/Password-Gen.jpg)\n\nYour encryption key will be set in the following Environment variable. SpringBoot Will automatically \npickup the encryption key from this environment variable. \n```\nJASYPT_ENCRYPTOR_PASSWORD=your-encrypton-key\n```\n\n#### 1.2.2 Update the Database passwords for H2 and PostgreSQL in the Property files\n\nUpdate the property file in the local file\n```\nspring.datasource.password=ENC(kkthRIyJ7ogLJP8PThfXjqko33snTUa9lY1GkyFpzr7KFRVhRVXLOMwNSIzr4EjFGAOWLhWTH5cAWzRzAfs33g==)\n```\nAND\n- the property template in src/main/resources/app.props.tmpl\n- dev src/main/resources/application-dev.properties\n```\nspring.datasource.password=ENC(kkthRIyJ7ogLJP8PThfXjqko33snTUa9lY1GkyFpzr7KFRVhRVXLOMwNSIzr4EjFGAOWLhWTH5cAWzRzAfs33g==)\n```\nAND \nthe property files for \n- staging src/main/resources/application-staging.properties \n- prod src/main/resources/application-prod.properties\n```\nspring.datasource.password=ENC(/J0gRHIdlhBHFwpNo3a+1q3+8Uig5+uSNQHO/lCGOrfg/e8Wt2o3v1eC4TaquaDVGREOEFphpw1B84lOtxgeIA==)\n```\n#### 1.2.3 - Generating the Encrypted Text from REST Endpoint\n\nYou can use the following REST Endpoint to encrypt the sensitive data. This will work only after setting\nthe environment variable JASYPT_ENCRYPTOR_PASSWORD and creating the first DB password\nusing the command line options.\n\n![Passowrd-Van](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/ms-vanilla-encrypt.jpg)\n\n###  Step 1.3 - Compile (Once your code is ready)\n\n#### 1.3.1 Compile the Code\nExecute the \"compile\" from ms-springboot-334-vanilla\n1. compile OR ./compile (Runs in Linux and Mac OS)\n2. mvn clean; mvn -e package; (All Platforms)\n3. Use the IDE Compile options\n\n#### 1.3.2 What the \"Compile\" Script will do\n\n1. Clean up the target folder\n2. Generate the build no. and build date (takes application.properties backup)\n3. build final output SpringBoot fat jar and maven thin jar\n4. copy the jar files (and dependencies) to src/docker folder\n5. copy the application.properties file to current folder and src/docker folder\n\nIn Step 1.3.2 application.properties file will be auto generated by the \"compile\" script. This is a critical step.\nWithout generated application.properties file the service will NOT be running. There is pre-built application properties file.\nFollowing three property files are critical (to be used with Spring Profiles)\n\n1. application.properties\n2. application-dev.properties\n3. application-staging.properties\n4. application-prod.properties\n\n### Step 1.4 - Run the Application \n\n#### 1.4.1 - Spring Profiles\n\n1. dev (Development Mode)\n2. staging (Staging Mode)\n3. prod (Production Mode)\n\n#### 1.4.2 - Start the Service\n1. Linux or Mac OS - Profiles (dev, staging, or prod)\n```aiignore\nrun \n```\n```aiignore\nrun dev \n```\n```aiignore\nrun staging \n```\n```aiignore\nrun prod \n```\n\n2. All Platforms - Profiles (dev, staging, or prod)\n```aiignore\n mvn spring-boot:run -Dspring-boot.run.profiles=dev\n```\n```aiignore\n mvn spring-boot:run -Dspring-boot.run.profiles=staging\n```\n```aiignore\n mvn spring-boot:run -Dspring-boot.run.profiles=prod\n```\n\n3. Microsoft Windows - Profiles (dev, staging, or prod)\n```aiignore\njava -jar target/ms-vanilla-service-*-spring-boot.jar --spring.profiles.active=dev  -Djava.security.manager=java.lang.SecurityManager -Djava.security.policy=./vanilla.policy\n```\n```aiignore\njava -jar target/ms-vanilla-service-*-spring-boot.jar --spring.profiles.active=staging  -Djava.security.manager=java.lang.SecurityManager -Djava.security.policy=./vanilla.policy\n```\n```aiignore\njava -jar target/ms-vanilla-service-*-spring-boot.jar --spring.profiles.active=prod  -Djava.security.manager=java.lang.SecurityManager -Djava.security.policy=./vanilla.policy\n```\n\n#### 1.4.3 - Test the Service \n1. test OR ./test (Runs in Linux or Mac OS)\n2. Execute the curl commands directly (from the test script)\n\n#### 1.4.4 - Running through IDE\nCheck the application.properties (in the project root directory) to change the profile Ex. spring.profiles.default=dev\n\n#### 1.4.5 - $ run prod (Result) \n![Run Results](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/MS-Run-Result.jpg)\n\n\n#### 1.4.6 - MS Cache Swagger UI Docs for Testing\n![Swagger Docs](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/MS-Vanilla-Swagger-UI.jpg)\n\n### Step 1.5 - Testing the APIs Using Swagger API Docs or Postman\n\nTo test the APIs (in secure mode - you will see a lock icon in the Swagger Docs). These test tokens are generated\nbased on the flag server.token.test=true in the application.properties file. (Change the app.props.tmpl if you want to\nchange in the build process.) In the Production environment, this flag should be false. These tokens can be generated only in\nan Auth Service. All the services need not generate these tokens unless for the developers to test it out.\nIn a real world scenario, disable (Comment out the function generateTestToken() from the code  java file \nServiceEventListener.java in the package documentation io.fusion.air.microservice.server.service)  this feature for \nproduction environment. \n\n#### Step 1.5.1: Copy the Auth Token\n![Authorize Request](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/ms-vanilla-with-Test-Tokens.jpg)\n\n#### Step 1.5.2: Click on the Authorize Button (Top Left the Swagger UI)\n\n![Authorize Request](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/ms-vanilla-with-Test-Tokens-2.jpg)\n\n#### Step 1.5.3: Enter the Token and Click Authorize\n\n![Authorize Request](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/ms-vanilla-with-Test-Tokens-3.jpg)\n\n#### Step 1.5.4: Enter the Refresh Token \u0026 Tx Token with every request that needs authorization\n\n![Authorize Request](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/ms-vanilla-with-Test-Tokens-4.jpg)\n\n### Step 1.6 -  Import Swagger API Docs Into Postman\n\nWhat is Postman?\n- Postman is an API platform for building and using APIs. Postman simplifies each step of the API \nlifecycle and streamlines collaboration so you can create better APIs—faster.\n- Download Postman for Windows, Mac \u0026 Linux. https://www.postman.com/\n\n#### Step 1.6.1: Swagger Open API 3.0 Docs JSON Format\n![Swagger JSON](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/Import-API-into-Postman-0.jpg)\n\n#### Step 1.6.2: Import Into Postman - Set the Link\n![Postman Import](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/Import-API-Into-Postman-1.jpg)\n\n#### Step 1.6.3: Import Into Postman - Confirm\n![Postman Import](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/Import-API-into-Postman-2.jpg)\n![Postman Import](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/Import-API-into-Postman-3.jpg)\n\n#### Step 1.6.4: Test the API\n![Postman Import](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/Import-API-into-Postman-4.jpg)\n\n### Step 1.7 - JWT Token Validation example\n\n####  1.7.1 Public API (Without Token Validation) - ...adapters.controllers.open.*\n![No-Authorizet](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/JWT-Public.jpg)\n\n#### 1.7.2 Secure API with a Single Token (Primarily to be used by ADMIN)\n![Authorizet-Single](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/JWT-Single.jpg)\n\n#### 1.7.3 Secure API with an Additional Tx Token which contains App Specific Claims.\n![Authorize-Tx](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/JWT-Tx.jpg)\n\n#### 1.7.4 All the APIs under the Secure Package (under ...adapters.controllers.secured.*)\n![Secured-Pkg](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/JWT-Secured-Pkg.jpg)\n\n## 2. CRUD Operations Demo \u0026 Error Handling\n\n### 2.1 CRUD Operations \n\n#### 2.1.1 GET Query Execution and Fallback Data\n\n![Crud Get](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-1-get-fallback.jpg)\n\n#### 2.1.2 POST Create Data - Product 1\n![Crud Post-1](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-2-post-prod-1-A.jpg)\n\n#### 2.1.3 POST Create Data - Product 1 : Result\n![Crud Post-2](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-2-post-prod-1-B.jpg)\n\n#### 2.1.4 POST Create Data - Product 2 \n![Crud Post-3](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-3-post-prod-2.jpg)\n\n#### 2.1.5 POST Create Data - Product 3\n![Crud Post-4](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-4-post-prod-3.jpg)\n\n#### 2.1.6 GET All the Data (Created in Steps 2.2 - 2.5)\n![Crud Get-6](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-5-get-from-db.jpg)\n\n#### 2.1.7 GET Single Record\n![Crud Get-7](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-6-get-from-db.jpg)\n\n#### 2.1.8 PUT Update the Product Price\n![Crud Get-8](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-7-put-update-price.jpg)\n\n#### 2.1.9 PUT Update the Product - DeActivate the Product \u003e Set isActive Flag = False\n![Crud Get-9](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-8-put-deactivate.jpg)\n\n#### 2.1.10 State of the Records after Inserts and Updates\n![Crud Get-10](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-9-db-records.jpg)\n\n### 2.2 Error Handling for SpringBoot App / Service\n\n#### 2.2.1 Error Handling - Invalid Input\n![Error-1](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-error-1-post-invalid-input-A.jpg)\n\n#### 2.2.2 Error Handling - Invalid Input - Result\n![Error-2](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-error-1-post-invalid-input-B.jpg)\n\n#### 2.2.3 Error Handling - Invalid Input - Field Validations\n![Error-3](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-error-2-post-invalid-input-A.jpg)\n\n#### 2.2.4 Error Handling - Invalid Input - Field Validations - Result\n![Error-4](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-error-2-post-invalid-input-B.jpg)\n\n#### 2.2.5 Error Handling - Version Mismatch based o JPA @Version Annotation\n![Error-5](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/crud/crud-error-3-post-Version-Mismatch-B.jpg)\n\n### 2.3 Log Management \n\n#### 2.3.1 Log Success Messages\n![Log-1](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/log/Log-Messages-1.jpg)\n\n#### 2.3.2 Log Failure Messages\n![Log-2](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/log/Log-Messages-2.jpg)\n\n## 3. Configure the Template: Setup Org, Service, \u0026 Container Name, Versions, API Path in app.props.tmpl\n\n1. git clone https://github.com/arafkarsh/ms-springboot-334-vanilla.git\n2. cd ms-springboot-334-vanilla\n\nUpdate the Properties Template\n\n1. Update the Org Name in src/main/resources/app.props.tmpl file (service.org)\n2. Update the Microservice name in src/main/resources/app.props.tmpl file (service.name)\n3. Update the API Version in src/main/resources/app.props.tmpl file (service.api.version)\n4. Update the API Name in src/main/resources/app.props.tmpl file (service.api.name)\n5. Update the Container Name in src/main/resources/app.props.tmpl file (service.container)\n6. Update the Server Version src/main/resources/app.props.tmpl file (server.version)\n   Pom File\n   \u003cversion\u003e0.4.0\u003c/version\u003e\n   app.props.tmpl\n   Microservice Server Properties\n   server.version=0.4.0\n\nSample Property File Template\n![Property File](https://raw.githubusercontent.com/arafkarsh/ms-springboot-334-vanilla/master/diagrams/MS-Property-File.jpg)\n\nWhen you change the version in POM.xml, update that info in src/main/resources/app.props.tmpl - server.version property also.\n\n## 4. Docker Container Setup\n\n### Step 4.1 - Verify Container Name and Org Name\n\n1. Verify the Org Name in src/main/resources/app.props.tmpl file (service.org)\n2. Verify the container name in src/main/resources/app.props.tmpl file (service.container)\n3. Verify the microservice name in src/main/resources/app.props.tmpl file (service.api.name)\n\n### Step 4.2 - Build the image\n\n1. build (Build the Container)\n2. scan (Scan the container vulnerabilities)\n\n### Step 4.3 - Test the image\n\n1. start (Start the Container)\n2. logs (to view the container logs) - Wait for the Container to Startup\n3. Check the URL in a Browser\n\n### Step 4.4 - Push the image to Container Cloud Repository\n\nUpdate the Org Name in src/main/resources/app.props.tmpl file (service.org)\nSetup the Docker Hub or any other Container Registry\n\n1. push (Push the Container to Docker Hub)\n\n### Step 4.5 Other Commands\n\n1. stop (Stop the Container)\n2. stats (show container stats)\n\n\n(C) Copyright 2021-25 : Apache 2 License : Author: Araf Karsh Hamid\n\n\u003cpre\u003e\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n\u003c/pre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farafkarsh%2Fms-springboot-vanilla","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farafkarsh%2Fms-springboot-vanilla","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farafkarsh%2Fms-springboot-vanilla/lists"}