Skip to main content

spring-framework-patterns

Apply Spring Framework best practices: dependency injection, transaction management, AOP for CIA services

Informations de source

Dépôt
Hack23/cia
Dernière activité de la source
1 février 2026 à 00:05
Langue détectée de SKILL.md
anglais
Étoiles
241
Forks
56

Options d'installation

Le prompt qui vérifie d'abord la source est sélectionné par défaut. Vous pouvez passer à une commande directe ou télécharger une copie locale.

Vérifiez les fichiers source

Lisez SKILL.md et les fichiers associés affichés par SkillsMP avant de décider de l'installer.

Affichage de SKILL.md

SKILL.md
Instructions source · Aperçu en lecture seule
name
spring-framework-patterns
description
Apply Spring Framework best practices: dependency injection, transaction management, AOP for CIA services
# 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 ```java @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 ```java @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 ```java @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
Voir sur GitHub