Skip to content

Commit 75b8a43

Browse files
Gaurav Gandhigandhi-21
authored andcommitted
update base readme for testing the update readme flow
1 parent d1d805b commit 75b8a43

File tree

1 file changed

+64
-66
lines changed
  • ui-tests-starter/tstData/qdoc/updateFlow

1 file changed

+64
-66
lines changed
Lines changed: 64 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
# Spring Boot REST API Service with Health Monitoring and Data Management
1+
# Spring Boot REST API: A Simple and Robust Microservice Template
22

3-
This Spring Boot application provides a RESTful API service with health monitoring capabilities and simple data management functionality. It offers a robust foundation for building microservices with built-in health checks and a flexible data storage interface.
3+
This Spring Boot application provides a lightweight REST API template with built-in health monitoring and data management capabilities. It offers a production-ready foundation for building microservices with comprehensive health checks, status monitoring, and data operations.
44

5-
The service implements health monitoring endpoints for infrastructure integration and a data management API for storing and retrieving items. Built with Spring Boot 3.2.0 and Java 17, it includes production-ready features through Spring Actuator and comprehensive testing support. The application uses an in-memory data store for demonstration purposes and can be easily extended for production use cases.
5+
The application implements a RESTful service with health monitoring endpoints and a flexible data management interface. It features configurable logging levels, actuator endpoints for operational insights, and a clean architecture that separates concerns between controllers and data models. Built with Spring Boot 3.2.0, it leverages modern Java 17 features and includes comprehensive test support through JUnit.
66

77
## Repository Structure
88
```
9-
ui-tests-starter/tstData/qdoc/updateFlow/
10-
├── build.gradle # Gradle build configuration with Spring Boot 3.2.0 dependencies
9+
.
10+
├── build.gradle # Gradle build configuration with Spring Boot 3.2.0 and dependencies
1111
├── config/
12-
│ └── application-local.yml # Local environment configuration with server and logging settings
13-
└── src/com/zetcode/tancode/
14-
├── App.java # Main Spring Boot application entry point
15-
├── controller/
16-
│ ├── HealthController.java # Health and status monitoring endpoints
17-
│ └── SampleController.java # Data management REST endpoints
18-
└── model/
19-
└── DataItem.java # Data model for item storage
12+
│ └── application-local.yml # Local environment configuration (port, app name, logging)
13+
└── src/
14+
└── com/example/
15+
├── App.java # Main application entry point with Spring Boot configuration
16+
├── controller/ # REST API endpoint definitions
17+
│ ├── HealthController.java # Health and status monitoring endpoints
18+
│ └── SampleController.java # Data management endpoints
19+
└── model/
20+
└── DataItem.java # Data model for API operations
2021
```
2122

2223
## Usage Instructions
24+
2325
### Prerequisites
24-
- Java Development Kit (JDK) 17 or later
25-
- Gradle 7.x or later
26-
- Port 8080 available on the host machine
26+
- Java Development Kit (JDK) 17 or higher
27+
- Gradle 8.x or higher
28+
- Basic understanding of Spring Boot and REST APIs
2729

2830

2931
### Quick Start
@@ -32,13 +34,14 @@ ui-tests-starter/tstData/qdoc/updateFlow/
3234
./gradlew bootRun
3335
```
3436

35-
2. Verify the service is running:
37+
2. Verify the application is running by accessing the health endpoint:
3638
```bash
3739
curl http://localhost:8080/api/health
3840
```
3941

4042
### More Detailed Examples
41-
1. Check service status:
43+
44+
1. Check Application Status
4245
```bash
4346
curl http://localhost:8080/api/status
4447
```
@@ -51,62 +54,57 @@ Expected response:
5154
}
5255
```
5356

54-
2. Store a data item:
57+
2. Health Check
5558
```bash
56-
curl -X PUT http://localhost:8080/api/data/1 \
57-
-H "Content-Type: application/json" \
58-
-d '{"content": "Sample content"}'
59+
curl http://localhost:8080/api/health
5960
```
60-
61-
3. Retrieve a data item:
62-
```bash
63-
curl http://localhost:8080/api/data/1
61+
Expected response:
62+
```json
63+
{
64+
"status": "UP",
65+
"message": "Service is healthy"
66+
}
6467
```
6568

6669
### Troubleshooting
67-
1. Service Not Starting
68-
- Problem: Application fails to start
69-
- Diagnosis:
70-
* Check if port 8080 is already in use
71-
* Verify Java version with `java -version`
72-
- Solution:
73-
* Change port in `config/application-local.yml`
74-
* Update Java installation if needed
75-
76-
2. Debug Mode
77-
- Enable debug logging:
78-
* Set `logging.level.com.example=DEBUG` in application-local.yml
79-
- Log location: Standard output when running locally
80-
- Monitor application logs:
81-
```bash
82-
tail -f logs/application.log
83-
```
70+
71+
1. Application Won't Start
72+
- **Problem**: Application fails to start with port binding issues
73+
- **Solution**:
74+
```bash
75+
# Check if port 8080 is already in use
76+
lsof -i :8080
77+
# Modify port in config/application-local.yml if needed
78+
```
79+
80+
2. Debugging
81+
- Enable debug logging by modifying `config/application-local.yml`:
82+
```yaml
83+
logging:
84+
level:
85+
com.example: DEBUG
86+
```
87+
- Check logs in console output for detailed information
88+
- Use Spring Boot Actuator endpoints for health monitoring:
89+
```bash
90+
curl http://localhost:8080/actuator/health
91+
```
8492

8593
## Data Flow
86-
The application processes REST requests through controllers, managing data items in an in-memory store while providing health monitoring capabilities.
94+
95+
The application processes HTTP requests through a layered architecture, transforming REST calls into data operations with proper error handling and response formatting.
8796

8897
```ascii
89-
Client Request
90-
91-
92-
[Spring Boot Server :8080]
93-
94-
├─── /api/health, /api/status
95-
│ │
96-
│ HealthController
97-
98-
└─── /api/data/{id}
99-
100-
SampleController
101-
102-
In-Memory Store
98+
Client Request → Controller Layer → Data Processing → Response
99+
↑ | | ↓
100+
└──────────────┴────────Error Handling─────────────┘
103101
```
104102

105-
Component Interactions:
106-
1. REST endpoints receive HTTP requests on port 8080
107-
2. HealthController provides system status and health information
108-
3. SampleController manages data items through GET and PUT operations
109-
4. DataItem objects are stored in an in-memory HashMap
110-
5. All responses are returned as JSON with appropriate HTTP status codes
111-
6. Health checks return UP status when service is operational
112-
7. Data operations are synchronized through Spring's request handling
103+
Key component interactions:
104+
1. Controllers receive HTTP requests and validate inputs
105+
2. Request data is mapped to internal data models
106+
3. Business logic processes the data operations
107+
4. Responses are formatted as JSON and returned to the client
108+
5. Error handling is managed across all layers
109+
6. Health monitoring provides real-time system status
110+
7. Logging captures operation details at configurable levels

0 commit comments

Comments
 (0)