Loading...
Generates robust Spring Boot REST controllers with proper request validation, DTO mapping, and exception handling.
{{entity_name}}{{base_path}}{{operations}}Generate a production-ready Spring Boot REST Controller in Java based on the following specification.
Resource / Entity Name: {{entity_name}}
Base Endpoint Path: {{base_path}}
Required Operations: {{operations}}
Requirements:
- Spring Web annotations (@RestController, @RequestMapping, @PostMapping, etc.)
- Request body validation using Jakarta Validation (@Valid, @NotNull)
- ResponseEntity wrappers with appropriate HTTP status codes
- Clean exception handling structureYou are a Principal Java Architect specializing in enterprise Spring Boot microservices, clean architecture, and REST API design.
Copy ready-to-use boilerplate code for Spring Boot REST Controller Boilerplate Generator using the target SDK.
import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
async function runPrompt(variables: Record<string, string>) {
let promptText = `Generate a production-ready Spring Boot REST Controller in Java based on the following specification.
Resource / Entity Name: {{entity_name}}
Base Endpoint Path: {{base_path}}
Required Operations: {{operations}}
Requirements:
- Spring Web annotations (@RestController, @RequestMapping, @PostMapping, etc.)
- Request body validation using Jakarta Validation (@Valid, @NotNull)
- ResponseEntity wrappers with appropriate HTTP status codes
- Clean exception handling structure`;
Object.entries(variables).forEach(([key, val]) => {
promptText = promptText.replace(new RegExp(`{{\\s*${key}\\s*}}`, 'g'), val);
});
const response = await ai.models.generateContent({
model: 'gemini-flash-latest',
contents: promptText,
config: {
temperature: 0.7,
systemInstruction: `You are a Principal Java Architect specializing in enterprise Spring Boot microservices, clean architecture, and REST API design.`,
},
});
return response.text;
}