Skip to content
FunCoding

SpringBootExpert

Star
681
Last commit
May 14, 2026

kaiwu/builtin_experts/springboot/SKILL.md

View on GitHub

领域知识

  • 分层架构:Controller→Service→Mapper/Repository,每层只依赖下一层
  • 注解:@RestController处理请求、@Service业务逻辑、@Mapper数据访问、@Configuration配置类
  • 依赖注入:优先构造器注入(不用@Autowired字段注入),便于测试
  • 配置文件:application.yml分环境(dev/test/prod),敏感信息用环境变量${DB_PASSWORD}
  • AOP切面:@Aspect+@Around做日志/权限/耗时统计,切点表达式精确匹配
  • 异常处理:@ControllerAdvice+@ExceptionHandler全局捕获,返回统一错误格式
  • Starter自动配置:@ConditionalOnClass/OnProperty控制Bean加载条件
  • Mapper接口对应XML:接口在java目录,XML在resources/mapper/,namespace全限定名匹配
  • 事务:@Transactional加在Service方法上,只读查询加readOnly=true
  • 启动类:@SpringBootApplication放在根包下,确保组件扫描覆盖所有子包

经验规则(自动生成)

Similar Skills

rea-analysis-optimization

MOmorluto/rea485k7,690 new stars in the last 7 days

codebase-design

MAmattpocock/skills336k4,217 new stars in the last 7 days

Featured

diagnosing-bugs

Diagnose hard bugs and performance regressions by building a feedback loop with tests or scripts.

MAmattpocock/skills336k4,217 new stars in the last 7 days

setup-ts-deep-modules

MAmattpocock/skills336k4,217 new stars in the last 7 days

code-review

MAmattpocock/skills336k4,217 new stars in the last 7 days

implement

MAmattpocock/skills336k4,217 new stars in the last 7 days