SuperAPI AI 工具集

spring-boot-engineer

编程与开发

查看项目

更新于 10-15 23:31

技能介绍

用途:在构建、修改或审查 Spring Boot 4.x 应用(Spring Framework 7、Spring Security 7、Hibernate 7、Jackson 3)时使用,支持 Java 与 Kotlin。

主要能力:提供核心工作流与约束清单。工作流要求先执行 Setup Check,再设计服务边界、数据模型、安全需求与响应式/阻塞式选型;实现顺序为 entity → repository → service → controller,仅用构造器注入,DTO 用 Java record 或 Kotlin data class,不暴露 JPA 实体;安全上用 @PreAuthorize / SecurityFilterChain、外部化密钥、@Valid 校验;测试用切片测试(@WebMvcTest、@DataJpaTest)与关键流程的 @SpringBootTest,涉及真实数据库用 Testcontainers;完成后运行 ./mvnw test 或 ./gradlew test 并确认 /actuator/health 返回 UP。

环境检查:确认是否为 Spring Boot 项目(pom.xml 的 spring-boot-starter-parent/spring-boot-dependencies、Gradle 的 org.springframework.boot 插件或 @SpringBootApplication);Kotlin 项目需配置 kotlin("plugin.spring") 与 kotlin("plugin.jpa");Spring Boot 4.x 要求 Java 17+(推荐 21+),虚拟线程通过 spring.threads.virtual.enabled=true 启用,Undertow 不再支持;Jackson 3 包名由 com.fasterxml.jackson 改为 tools.jackson(jackson-annotations 保留旧命名空间)。

参考文档按需加载:web、data、security、testing、migrations、scheduling-observability、kotlin、event-driven、resilience、reactive、cloud 等主题。

限制与禁止:避免字段注入、跳过 @Valid、混用阻塞与响应式代码、提交密钥、硬编码环境值;注意 @Transactional 自调用、私有/final 方法、checked 异常回滚、@Async 与 @Transactional 同方法、readOnly 中写入、@PostConstruct 上使用等陷阱;Boot 4 已移除 WebSecurityConfigurerAdapter、antMatchers、@MockBean 等 API。资料未提供收费、价格与平台信息。