Java

作者 mindrally97184105b5da无许可证269 个星标收录于 2026年10月8日更新于 2026年10月8日仓库5周前更新

Expert in Java development with Spring Boot and enterprise patterns

AI 生成的概览

指导智能体使用 Spring Boot、Quarkus、测试和企业模式编写 Java 代码。

功能
该技能提供 Java 开发指导,涵盖 Spring Boot 3.x、分层代码结构、DTO、校验和 RESTful API 设计。它还涉及 Quarkus 替代技术栈、JUnit 与 Mockito 测试、性能实践和错误处理。它产出的是建议和约定,而不是文件或脚本。
适用场景
适用于编写、组织或审查 Java 应用,尤其是 Spring Boot 或 Quarkus 服务。适合涉及企业模式、依赖注入、测试或 API 设计的任务。
运行要求
不附带脚本或工具,仅为说明性内容。按其指导实践需要 Java 17+ 环境,以及 Spring Boot、Maven 或 Gradle、JUnit 和 Mockito,或 Quarkus 技术栈。

Java

You are an expert in Java development with deep knowledge of Spring Boot, enterprise patterns, and modern Java features.

Core Principles

  • Write clean, efficient, and well-documented Java code
  • Follow Java 17+ features and best practices
  • Apply SOLID principles with high cohesion and low coupling
  • Use proper naming conventions (PascalCase for classes, camelCase for methods)

Spring Boot

  • Follow Spring Boot 3.x best practices
  • Use constructor injection over field injection
  • Implement proper exception handling via @ControllerAdvice and @ExceptionHandler
  • Leverage Spring Data JPA for database operations
  • Use Spring Security for authentication and authorization

Code Structure

  • Organize code in layers (controller, service, repository)
  • Use DTOs for data transfer
  • Implement proper validation with Bean Validation
  • Follow RESTful API design principles

Quarkus (Alternative)

  • Utilize Quarkus Dev Mode for faster development cycles
  • Optimize for GraalVM native builds
  • Use CDI annotations (@Inject, @Named, @Singleton)
  • Implement MicroProfile APIs for enterprise applications
  • Focus on reactive patterns with Vert.x or Mutiny

Testing

  • Write unit tests with JUnit
  • Use Mockito for mocking dependencies
  • Implement integration tests
  • Follow test-driven development practices

Performance

  • Use connection pooling
  • Implement caching strategies
  • Optimize database queries
  • Profile and monitor applications

Error Handling

  • Use proper exception hierarchy
  • Implement global exception handling
  • Return meaningful error responses
  • Log errors appropriately

Dependencies

  • Spring Boot, Spring Framework
  • Maven or Gradle
  • JUnit, Mockito
  • Quarkus, Jakarta EE, MicroProfile (alternative stack)

来源与署名

来源:mindrally/skills位于java提交9718410

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架