Overview
This prompt aims to guide developers in creating a Java Spring Boot module for managing action memos. Programmers and software engineers will benefit by receiving a structured approach to implementing this functionality efficiently.
Prompt Overview
Purpose: This module manages action memos efficiently within a Java Spring Boot application.
Audience: It is designed for developers and teams working on backend services in Java Spring Boot.
Distinctive Feature: The module utilizes JPA for database interactions and Lombok for reducing boilerplate code.
Outcome: Developers will have a structured approach to manage action memos with robust error handling and logging.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Cryptocurrency & Blockchain, Development Tools & DevOps, Productivity & Workflow
- Techniques: Structured Output
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
Create a Java Spring Boot module for managing action memos with the following components:
1. Entity Class:
– Define an entity `ActionMemo` representing the `PORTAL_ACTION_MEMOS` table with fields:
– `memoId`
– `controlCode`
– `claimId`
– `healthFacility`
– `physician`
– `batchNumber`
– `patientName`
– `accountName`
– `approvalNumber`
– `availmentDate`
– `memoType`
– `action`
– `dateCreated`
– `createdBy`
– `serviceType`
– `status`
– `providerUserId`
– `createdTs`
– `createdByField`
– `updatedTs`
– `updatedBy`
– `message`
– `type`
– `providerCode`
– Use JPA annotations:
– `@Entity`
– `@Table`
– Primary key annotations like `@Id`, `@GeneratedValue`
– Column mappings with `@Column`
– Relationships with `@ManyToOne`, `@JoinColumn`
– Specify `insertable=false, updatable=false` where necessary.
– Include Lombok annotations:
– `@Data`
– `@NoArgsConstructor`
2. Request Class:
– Create a `PendingMemoRequest` with fields:
– `page`
– `size`
– `search`
– `status`
– `memoType`
– `fromDate`
– `toDate`
– Add validation annotations such as:
– `@NotNull`
– `@NotBlank`
– Use `@Data` to generate boilerplate code.
3. Response Class:
– Define `PendingMemoResponse` containing:
– A list of `MemoResponse` objects, each having fields:
– `memoId`
– `controlCode`
– `healthFacility`
– `physician`
– `batchNumber`
– `patientName`
– `accountName`
– `approvalNumber`
– `availmentDate`
– `submissionDate`
– `memoType`
– `status`
– `documentId`
– Pagination info:
– `currentPage`
– `pageSize`
– `totalPages`
– `totalRecords`
4. API Response Wrapper:
– Use the provided generic `ApiResponse` class to standardize all API responses with:
– `responseCode`
– `message`
– `errorDetails`
– `data`
– ISO 8601 `timestamp`
5. Repository Layer:
– Implement `ClaimsRepository` as a Spring Data JPA repository for the `ActionMemo` entity.
6. Service Layer:
– Define the interface `MemoService` with method:
– `PendingMemoResponse getMemoListByStatus(PendingMemoRequest request);`
– Implement this interface in `MemoServiceImpl`:
– Handle pagination and normalize filters (convert date ranges to IST, clean filters).
– Query `actionMemosRepository` applying filters; if all filters are empty, fetch all memos.
– Map queried data to a list of `MemoResponse`.
– Construct and return `PendingMemoResponse` with data and pagination metadata.
– Use SLF4J for logging throughout the service.
7. Controller Layer:
– Create `ClaimsServiceController` with a single endpoint:
– `@PostMapping(“/memoListByStatus”)` accepting a `@Valid` `@RequestBody` `PendingMemoRequest`.
– Calls `MemoService.getMemoListByStatus()` and returns an `ApiResponse`.
8. Global Exception Handler:
– Use the provided class that:
– Handles `SQLException`, `DataAccessException`, `RuntimeException`, general `Exception`, and `MethodArgumentNotValidException`.
– Logs exceptions appropriately.
– Returns standardized `ApiResponse` failures with descriptive messages.
**Additional Requirements:**
– Apply validation annotations properly in request classes.
– Use Lombok annotations for cleaner model classes.
– Add detailed SLF4J logs in service implementation.
– Follow best Spring Boot practices for layered architecture.
# Steps
9. Design the `ActionMemo` entity mapping to the database structure.
10. Create `PendingMemoRequest` and apply validation constraints.
11. Define `PendingMemoResponse` and `MemoResponse` DTOs.
12. Implement `ClaimsRepository` using Spring Data JPA.
13. Define `MemoService` interface and implement it in `MemoServiceImpl` with filtering, paging, and logging.
14. Create `ClaimsServiceController` with POST endpoint.
15. Integrate and configure the global exception handler.
# Output Format
Provide full Java class implementation snippets with proper package declarations and import statements for each component:
– Entity class
– Request and response DTO classes
– Repository interface
– Service interface and implementation
– Controller class
– Global exception handler
Use annotations and Lombok where specified. Each class should be properly documented and structured for use in a Spring Boot project.
# Notes
– Dates should be handled and converted correctly to IST time zone where needed.
– Ensure validation error messages are meaningful.
– Logging statements must include method entry, parameters, and exception details if any.
– Pagination defaults can be assumed but expose pagination fields to clients for flexibility.
– The controller method should return `ApiResponse.success()` wrapping the `PendingMemoResponse` on success.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Paste it into your preferred code editor.
- Follow the outlined steps to create the Java Spring Boot module.
- Implement each component as specified in the prompt.
- Test the module for functionality and correctness.
- Refine and document your code as needed.
Tips for Best Results
- Define Entity Class: Create `ActionMemo` with JPA and Lombok annotations to represent the database table.
- Create Request Class: Implement `PendingMemoRequest` with validation annotations to ensure data integrity.
- Implement Service Layer: Define `MemoService` and implement it in `MemoServiceImpl` for business logic and pagination handling.
- Set Up Controller: Create `ClaimsServiceController` with a POST endpoint to handle memo requests and return standardized API responses.
FAQ
- What is the purpose of the ActionMemo entity class?
It represents the PORTAL_ACTION_MEMOS table and defines its fields and relationships. - How does the PendingMemoRequest class validate input?
It uses annotations like @NotNull and @NotBlank to ensure required fields are filled. - What does the MemoService interface do?
It defines a method to retrieve a list of memos based on their status. - What is the role of the global exception handler?
It manages exceptions, logs errors, and returns standardized API responses on failures.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


