Implement Spring Framework best practices like DI, AOP, and transaction management in Java.
Install
mkdir -p .claude/skills/spring-framework-patterns && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/9345" && unzip -o skill.zip -d .claude/skills/spring-framework-patterns && rm skill.zipInstalls to .claude/skills/spring-framework-patterns
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Apply Spring Framework best practices: dependency injection, transaction management, AOP for CIA servicesKey capabilities
- →Implement constructor injection for services
- →Manage read-only and transactional methods
- →Apply aspect-oriented programming for cross-cutting concerns
- →Monitor method execution duration using AOP
- →Log audit events within transactions
How it works
The skill provides code examples for applying Spring annotations like @Service, @Transactional, and @Aspect to implement common design patterns.
Inputs & outputs
When to use spring-framework-patterns
- →Implement dependency injection
- →Manage service transactions
- →Apply AOP for logging
About this skill
Spring Framework Patterns Skill
Purpose
Apply Spring Framework best practices for dependency injection, transactions, and aspect-oriented programming.
When to Use
- ✅ Creating Spring services and components
- ✅ Managing transactions
- ✅ Implementing cross-cutting concerns
- ✅ Configuring application context
Dependency Injection Patterns
@Service
public class PoliticianService {
private final PoliticianRepository repository;
private final AuditLogger auditLogger;
// Constructor injection (preferred)
public PoliticianService(
PoliticianRepository repository,
AuditLogger auditLogger) {
this.repository = repository;
this.auditLogger = auditLogger;
}
}
Transaction Management
@Service
@Transactional(readOnly = true)
public class VotingService {
@Transactional
public void recordVote(Vote vote) {
voteRepository.save(vote);
statisticsService.updateStats(vote);
auditLogger.log("VOTE_RECORDED", vote.getId());
}
}
Aspect-Oriented Programming
@Aspect
@Component
public class PerformanceMonitoringAspect {
@Around("@annotation(Monitored)")
public Object monitor(ProceedingJoinPoint joinPoint) throws Throwable {
long start = System.currentTimeMillis();
try {
return joinPoint.proceed();
} finally {
long duration = System.currentTimeMillis() - start;
log.info("Method {} took {}ms",
joinPoint.getSignature().getName(), duration);
}
}
}
References
- Spring Framework: https://docs.spring.io/spring-framework/reference/
- ARCHITECTURE.md
When not to use it
- →When not creating Spring services and components
- →When not managing transactions in Spring
- →When not implementing cross-cutting concerns with AOP
Limitations
- →Limited to Spring Framework patterns
- →Focuses on dependency injection, transaction management, and AOP
- →Examples are in Java
How it compares
This skill offers concrete code snippets for Spring patterns, directly demonstrating their application, unlike general documentation that describes concepts without specific implementation examples.
Compared to similar skills
spring-framework-patterns side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| spring-framework-patterns (this skill) | 0 | 6mo | No flags | Intermediate |
| java-pro | 34 | 4mo | No flags | Advanced |
| backend-microservice-development | 2 | 3mo | No flags | Intermediate |
| microservice-infrastructure | 4 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by Hack23
View all by Hack23 →You might also like
java-pro
sickn33
Master Java 21+ with modern features like virtual threads, pattern matching, and Spring Boot 3.x. Expert in the latest Java ecosystem including GraalVM, Project Loom, and cloud-native patterns. Use PROACTIVELY for Java development, microservices architecture, or performance optimization.
backend-microservice-development
TencentBlueKing
后端微服务开发规范,涵盖目录结构、分层架构(API/Service/DAO)、依赖注入、配置管理、Spring Boot 最佳实践。当用户进行后端开发、创建新微服务、编写 Kotlin/Java 代码或设计服务架构时使用。
microservice-infrastructure
TencentBlueKing
微服务基础设施指南,涵盖条件配置、事件驱动架构、服务间通信、国际化与日志等微服务架构的核心基础设施。当用户实现服务间调用、配置多环境、实现异步通信、处理国际化或规范日志输出时使用。
common-technical-practices
TencentBlueKing
通用技术实践指南,涵盖 AOP 切面、分布式锁、重试机制、参数校验、性能监控、定时任务、审计日志等后端开发中的常见技术实践。当用户需要实现横切关注点、处理并发控制、配置重试策略、添加性能监控或实现审计功能时使用。
spring-boot-config-refactor
sklintyg
Refactor a Spring Boot application's configuration from legacy application.properties and scattered @Value usage to structured YAML and immutable @ConfigurationProperties records. Use this when migrating messy configuration, standardizing property naming, introducing app-prefixed custom properties,
spring-boot-4-conventions
loiane
Spring Framework 7 / Spring Boot 4 idioms and defaults. Use when writing or reviewing controllers, services, configuration, HTTP clients, async/virtual-thread code, or anything touching Spring's programming model.