springboot-backend-conventions

Guides Spring Boot configuration, bean wiring, transactions, and observability practices for BK-CI backend code.

2.5k|524|Updated May 29, 2019
One-click install
npx skills add https://github.com/TencentBlueKing/bk-ci --skill springboot-backend-conventions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: springboot-backend-conventions
Source: https://github.com/TencentBlueKing/bk-ci/tree/main/ai/skills/springboot-backend-conventions
Command: npx skills add https://github.com/TencentBlueKing/bk-ci --skill springboot-backend-conventions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

When writing or reviewing BK-CI Spring Boot backend code, developers often lack a consistent reference for framework-level decisions such as configuration management, bean assembly, transaction boundaries, exception handling, and monitoring, leading to scattered practices and unstable services.

Core Features & Use Cases

  • Configuration and Bean Assembly Guidance: Covers multi-environment configuration separation, type-safe binding, constructor injection, conditional assembly with @ConditionalOn*, and lifecycle boundary management.
  • Data Access, Transactions, and Exceptions: Provides rules for repository design, transaction propagation, read-only queries, layered exception handling, and unified global error responses.
  • Observability, Testing, and Quality: Defines expectations for Actuator endpoints, business metrics, structured logging, and layered testing strategies.
  • Use Case: When refactoring a BK-CI microservice that mixes field injection, unclear transaction boundaries, and inconsistent exception responses, use this Skill to audit the code against framework best practices and produce a concrete improvement plan.

Quick Start

Review my Spring Boot service configuration and transaction handling against BK-CI backend conventions and point out violations.

Frequently Asked Questions about springboot-backend-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage Spring Boot configuration across multiple environments?

Separate main configuration from environment-specific configuration, keep naming consistent, and prefer type-safe binding. Never hardcode sensitive values; inject them through environment variables or a configuration center instead.

What is the recommended dependency injection style in Spring Boot?

Constructor injection is the default recommendation because it improves testability and makes dependencies explicit. Use @Configuration with @Bean for complex beans, @ConditionalOn* for conditional assembly, and @Qualifier or @Primary when multiple implementations exist.

How should transaction boundaries be designed in Spring Boot services?

Match transaction propagation behavior to business boundaries, prefer read-only transactions for query operations, and consider timeout, retry, and idempotency together. Vague transaction boundaries lead to uncontrolled side effects.

When should I not use this Spring Boot conventions skill?

Do not use it when the question is only about which microservice owns a feature, pure Kotlin language style, or API contract design without Spring Boot framework concerns. Those belong to microservice layering, language style, or API design guidelines respectively.

Why does field injection cause problems in Spring Boot projects?

Field injection hides dependencies, complicates unit testing, and makes lifecycle boundaries unclear. Constructor injection exposes required collaborators explicitly and works better with immutable designs and framework-managed lifecycles.