# bzdgn/spring-boot-restful-web-service-example architecture

> Architecture diagram of the GitHub repository bzdgn/spring-boot-restful-web-service-example, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bzdgn/spring-boot-restful-web-service-example
- Repository: https://github.com/bzdgn/spring-boot-restful-web-service-example

## Overview

This Spring Boot sample exposes a REST API for listing and CRUD operations on consultants, plus a test greeting endpoint. Requests pass from the controller through the consultant service to a repository implementation, with a JPA-backed option and an in-memory stub; README documents embedded Tomcat/H2 and external selection of implementations. AppConfig explicitly selects one greeting implementation from an external properties file. Source excerpts show the JPA and stub behavior; wiring of the consultant repository choice and details of greeting variants are not fully shown.

Main entry points: [`src/main/java/com/levent/consultantapi/controller/ConsultantController.java`](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/controller/ConsultantController.java) (Consultant Controller), [`src/main/java/com/levent/consultantapi/repository/impl/ConsultantJPARepository.java`](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/repository/impl/ConsultantJPARepository.java) (Spring Data JPA), [`src/main/java/com/levent/consultantapi/config/AppConfig.java`](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/config/AppConfig.java) (Implementation Selector), [`src/main/java/com/levent/consultantapi/service/consultant/impl/ConsultantServiceImpl.java`](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/service/consultant/impl/ConsultantServiceImpl.java) (Consultant Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_controller["Consultant Controller"]
end

subgraph group_domain["Consultant Domain"]
  node_service["Consultant Service"]
  node_entity["Consultant Entity<br/>[Consultant.java]"]
  node_greeting["Greeting Contract<br/>[InfoService.java]"]
  node_greetvariants["Greeting Variants"]
end

subgraph group_persistence["Persistence"]
  node_repository["Repository Contract"]
  node_jpaadapter["JPA Repository Adapter"]
  node_jpa["Spring Data JPA"]
  node_stub["In-Memory Repository"]
  node_database[("H2 Database")]
end

subgraph group_configuration["Configuration"]
  node_app["Spring Boot Entry<br/>[EntryPoint.java]"]
  node_appconfig["Implementation Selector<br/>[AppConfig.java]"]
  node_properties["External Properties"]
end

node_caller(("API Client"))

node_caller -->|"sends requests"| node_controller
node_controller -->|"delegates CRUD"| node_service
node_service -->|"invokes operations"| node_repository
node_jpaadapter -->|"calls persistence"| node_jpa
node_jpa -->|"persists entity"| node_entity
node_stub -->|"stores objects"| node_entity
node_jpa -.->|"uses H2 store"| node_database
node_controller -->|"requests greeting"| node_greeting
node_appconfig -->|"reads selector"| node_properties
node_appconfig -->|"selects implementation"| node_greetvariants
node_greetvariants -->|"implements contract"| node_greeting
node_app -.->|"hosts API"| node_controller

click node_app "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/EntryPoint.java"
click node_controller "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/controller/ConsultantController.java"
click node_service "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/service/consultant/impl/ConsultantServiceImpl.java"
click node_entity "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/model/Consultant.java"
click node_repository "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/repository/ConsultantRepository.java"
click node_jpaadapter "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/repository/impl/ConsultantJPARepositoryImpl.java"
click node_jpa "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/repository/impl/ConsultantJPARepository.java"
click node_stub "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/repository/impl/ConsultantStubImpl.java"
click node_greeting "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/service/InfoService.java"
click node_greetvariants "https://github.com/bzdgn/spring-boot-restful-web-service-example/tree/master/src/main/java/com/levent/consultantapi/service/info/impl"
click node_appconfig "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/config/AppConfig.java"
click node_properties "https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/config/implementation.properties"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controller,node_caller toneBlue
class node_service,node_entity,node_greeting,node_greetvariants toneAmber
class node_repository,node_jpaadapter,node_jpa,node_stub,node_database toneMint
class node_app,node_appconfig,node_properties toneRose
```

## Components

### REST API

- [Consultant Controller](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/controller/ConsultantController.java): `src/main/java/com/levent/consultantapi/controller/ConsultantController.java`

### Consultant Domain

- [Consultant Service](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/service/consultant/impl/ConsultantServiceImpl.java): `src/main/java/com/levent/consultantapi/service/consultant/impl/ConsultantServiceImpl.java`
- [Consultant Entity](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/model/Consultant.java): `src/main/java/com/levent/consultantapi/model/Consultant.java`
- [Greeting Contract](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/service/InfoService.java): `src/main/java/com/levent/consultantapi/service/InfoService.java`
- [Greeting Variants](https://github.com/bzdgn/spring-boot-restful-web-service-example/tree/master/src/main/java/com/levent/consultantapi/service/info/impl): `src/main/java/com/levent/consultantapi/service/info/impl`

### Persistence

- [Repository Contract](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/repository/ConsultantRepository.java): `src/main/java/com/levent/consultantapi/repository/ConsultantRepository.java`
- [JPA Repository Adapter](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/repository/impl/ConsultantJPARepositoryImpl.java): `src/main/java/com/levent/consultantapi/repository/impl/ConsultantJPARepositoryImpl.java`
- [Spring Data JPA](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/repository/impl/ConsultantJPARepository.java): `src/main/java/com/levent/consultantapi/repository/impl/ConsultantJPARepository.java`
- [In-Memory Repository](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/repository/impl/ConsultantStubImpl.java): `src/main/java/com/levent/consultantapi/repository/impl/ConsultantStubImpl.java`
- **H2 Database**

### Configuration

- [Spring Boot Entry](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/EntryPoint.java): `src/main/java/com/levent/consultantapi/EntryPoint.java`
- [Implementation Selector](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/src/main/java/com/levent/consultantapi/config/AppConfig.java): `src/main/java/com/levent/consultantapi/config/AppConfig.java`
- [External Properties](https://github.com/bzdgn/spring-boot-restful-web-service-example/blob/master/config/implementation.properties): `config/implementation.properties`

### Other components

- **API Client**

## Connections

- API Client → Consultant Controller: sends requests (evidence: `src/main/java/com/levent/consultantapi/controller/ConsultantController.java`)
- Consultant Controller → Consultant Service: delegates CRUD (evidence: `src/main/java/com/levent/consultantapi/controller/ConsultantController.java`)
- Consultant Service → Repository Contract: invokes operations (evidence: `src/main/java/com/levent/consultantapi/service/consultant/impl/ConsultantServiceImpl.java`)
- JPA Repository Adapter → Spring Data JPA: calls persistence (evidence: `src/main/java/com/levent/consultantapi/repository/impl/ConsultantJPARepositoryImpl.java`)
- Spring Data JPA → Consultant Entity: persists entity (evidence: `src/main/java/com/levent/consultantapi/repository/impl/ConsultantJPARepository.java`)
- In-Memory Repository → Consultant Entity: stores objects (evidence: `src/main/java/com/levent/consultantapi/repository/impl/ConsultantStubImpl.java`)
- Spring Data JPA → H2 Database: uses H2 store (evidence: `README.md`)
- Consultant Controller → Greeting Contract: requests greeting (evidence: `src/main/java/com/levent/consultantapi/controller/ConsultantController.java`)
- Implementation Selector → External Properties: reads selector (evidence: `src/main/java/com/levent/consultantapi/config/AppConfig.java`)
- Implementation Selector → Greeting Variants: selects implementation (evidence: `src/main/java/com/levent/consultantapi/config/AppConfig.java`)
- Greeting Variants → Greeting Contract: implements contract (evidence: `src/main/java/com/levent/consultantapi/service/info/impl/InfoServiceImpl4.java`)
- Spring Boot Entry → Consultant Controller: hosts API (evidence: `README.md`)
