CopilotHub
SearchPromptsInstructionsAgentsToolsMCPs
  1. Home
  2. Instructions
  3. Spring Boot Development
Back to Instructions

Spring Boot Development

Coding standards for springboot.instructions

go
0 downloads
75 views
0

Tags

testing
security
documentation

Related Instructions

View all →

Python Docstring Standards

*.py

Write clear and consistent Python docstrings

python
python
documentation
+1
1
117

API Route Security

app/api/**/*.ts

Security best practices for Next.js API routes

typescript
nextjs
security
api
+2
0
113

WordPress Development — Copilot Instructions

Coding standards for wordpress.instructions

typescript
testing
security
+5
1
185

VueJS 3 Development Instructions

Coding standards for vuejs3.instructions

typescript
react
testing
security
+6
0
157

TypeScript MCP Server Development

Coding standards for typescript mcp server.instructions

typescript
express
testing
security
+5
0
126

TypeScript Development

These instructions assume projects are built with TypeScript 5.x (or newer) compiling to an ES2022 JavaScript baseline. Adjust guidance if your runtime requires older language targets or down-level transpilation.

typescript
express
testing
security
+6
0
143
Browse More Instructions

CopilotHub

A curated collection of prompts, instructions, agents, and tools for AI-powered development.

Quick Links

  • Prompts
  • Instructions
  • Agents
  • Tools
  • MCPs
  • Search

Browse by Category

  • Code Generation
  • Debugging
  • Documentation
  • Refactoring
  • Testing
  • Security

Legal

  • Guidelines
  • About
  • Privacy Policy
  • Terms of Service

Community

GitHub

© 2026 CopilotHub.

Spring Boot Development

General Instructions

  • Make only high confidence suggestions when reviewing code changes.
  • Write code with good maintainability practices, including comments on why certain design decisions were made.
  • Handle edge cases and write clear exception handling.
  • For libraries or external dependencies, mention their usage and purpose in comments.

Spring Boot Instructions

Dependency Injection

  • Use constructor injection for all required dependencies.
  • Declare dependency fields as private final.

Configuration

  • Use YAML files (application.yml) for externalized configuration.
  • Environment Profiles: Use Spring profiles for different environments (dev, test, prod)
  • Configuration Properties: Use @ConfigurationProperties for type-safe configuration binding
  • Secrets Management: Externalize secrets using environment variables or secret management systems

Code Organization

  • Package Structure: Organize by feature/domain rather than by layer
  • Separation of Concerns: Keep controllers thin, services focused, and repositories simple
  • Utility Classes: Make utility classes final with private constructors

Service Layer

  • Place business logic in @Service-annotated classes.
  • Services should be stateless and testable.
  • Inject repositories via the constructor.
  • Service method signatures should use domain IDs or DTOs, not expose repository entities directly unless necessary.

Logging

  • Use SLF4J for all logging (private static final Logger logger = LoggerFactory.getLogger(MyClass.class);).
  • Do not use concrete implementations (Logback, Log4j2) or System.out.println() directly.
  • Use parameterized logging: logger.info("User {} logged in", userId);.

Security & Input Handling

  • Use parameterized queries | Always use Spring Data JPA or NamedParameterJdbcTemplate to prevent SQL injection.
  • Validate request bodies and parameters using JSR-380 (@NotNull, @Size, etc.) annotations and BindingResult

Build and Verification

  • After adding or modifying code, verify the project continues to build successfully.
  • If the project uses Maven, run mvn clean package.
  • If the project uses Gradle, run ./gradlew build (or gradlew.bat build on Windows).
  • Ensure all tests pass as part of the build.

Useful Commands

Gradle CommandMaven CommandDescription
./gradlew bootRun./mvnw spring-boot:runRun the application.
./gradlew build./mvnw packageBuild the application.
./gradlew test./mvnw testRun tests.
./gradlew bootJar./mvnw spring-boot:repackagePackage the application as a JAR.
./gradlew bootBuildImage./mvnw spring-boot:build-imagePackage the application as a container image.