Overview
This prompt guides developers in implementing a method to retrieve application history using specified parameters in a Spring application. Programmers and software engineers will benefit by gaining clarity on how to structure their code effectively.
Prompt Overview
Purpose: This method retrieves application history based on specified parameters.
Audience: It is intended for developers using Spring Framework or Spring Boot.
Distinctive Feature: The method utilizes Spring’s `@RequestParam` for parameter binding.
Outcome: It returns a list of `ApplicationHistory` records filtered by application name and Cloud Foundry site.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Cloud Infrastructure & Platforms, Creative Writing & Storytelling, Development Tools & DevOps
- Techniques: Role/Persona Prompting
- 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
Add a method named `getAppHistory` in the appropriate controller or service class that accepts two request parameters:
– `applicationName`
– `cloudFoundrySite`
These parameters should be annotated with `@RequestParam` as follows:
“`java
@RequestParam(“applicationName”) String applicationName,
@RequestParam(“cloudFoundrySite”) String cloudFoundrySite
“`
This method must utilize these parameters to fetch a list of application history records from the database.
In the `ApplicationHistoryRepository.java` interface, ensure there is a method that accepts two `String` parameters:
– `(String appName, String cfSite)`
and returns a `List`. This repository method will be used by `getAppHistory` to retrieve the relevant application history data.
# Steps
1. Define the method in the controller or service class with the specified `@RequestParam` annotations.
2. In `ApplicationHistoryRepository.java`, define a method:
“`java
List findByAppNameAndCfSite(String appName, String cfSite);
“`
3. Implement the logic in `getAppHistory` to call the repository method using the received parameters.
4. Return the list of `ApplicationHistory` records obtained from the repository.
# Output Format
Provide the Java method code for `getAppHistory`, including annotations, and the repository method signature in `ApplicationHistoryRepository.java`. Ensure to use proper Java syntax and annotations.
# Notes
– Assume standard Spring Framework or Spring Boot conventions.
– The method’s purpose is to expose an HTTP endpoint (if in a controller) or service method to retrieve application history filtered by application name and Cloud Foundry site.
– The repository method should be correctly named to allow Spring Data JPA to implement it automatically, if applicable.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Paste it into your preferred code editor.
- Follow the steps outlined in the prompt.
- Implement the `getAppHistory` method in your controller or service.
- Define the repository method in `ApplicationHistoryRepository.java`.
- Test the implementation to ensure it retrieves application history.
Tips for Best Results
- Define the method: Create `getAppHistory` in your controller/service with `@RequestParam` annotations for `applicationName` and `cloudFoundrySite`.
- Repository method: In `ApplicationHistoryRepository.java`, add `List findByAppNameAndCfSite(String appName, String cfSite);` to fetch records.
- Implement logic: In `getAppHistory`, call the repository method using the parameters to retrieve the application history.
- Return results: Ensure `getAppHistory` returns the list of `ApplicationHistory` records obtained from the repository.
FAQ
- What parameters does the getAppHistory method accept?
It accepts applicationName and cloudFoundrySite as request parameters. - What annotation is used for request parameters in Spring?
The @RequestParam annotation is used to specify request parameters. - What is the return type of the repository method?
The repository method returns a List<ApplicationHistory>. - What is the purpose of the getAppHistory method?
It retrieves application history records based on the provided application name and Cloud Foundry site.
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.


