What problem does it solve?
Developing Java applications with CDI (Contexts and Dependency Injection) and Quarkus can be complex, especially when aiming for native compilation, secure containerization, and robust testing. This Skill provides a comprehensive set of standards to ensure consistent, high-quality, and performant Java development, automating best practices and reducing common pitfalls.
Core Features & Use Cases
- CDI Best Practices: Enforces constructor injection, proper scoping, and producer method patterns for clean, testable code.
- Secure Containerization: Guides Dockerfile creation with security hardening, non-root execution, and optimized health checks.
- Quarkus Native Optimization: Provides patterns for
@RegisterForReflection and deployment processors to achieve efficient native images.
- Use Case: When building a new Quarkus microservice, use this skill to ensure your CDI beans are correctly injected, your Docker image is secure and optimized, and your native compilation is configured for peak performance, letting AI handle the complex configuration details.
Quick Start
Implement Dependency Injection
- Use constructor injection (never field injection)
- Make injected fields
final
- Select appropriate scope (@ApplicationScoped for stateless)
- Avoid @Singleton unless eager initialization required
- Use Instance<T> for optional dependencies
- Add qualifiers for disambiguation
Create Secure Docker Image
- Use minimal base image (UBI, distroless)
- Run as non-root user
- Configure health checks
- Set resource limits
- Use multi-stage builds
- Scan for vulnerabilities