java-cdi

Implements Jakarta CDI patterns including constructor injection, bean scopes, producer methods, events/observers, and interceptors in Java/C++ projects.

4|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/cuioss/plan-marshall --skill java-cdi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: java-cdi
Source: https://github.com/cuioss/plan-marshall/tree/main/marketplace/bundles/pm-dev-java/skills/java-cdi
Command: npx skills add https://github.com/cuioss/plan-marshall --skill java-cdi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps Java developers implement Jakarta CDI patterns correctly and consistently, reducing boilerplate and misconfigurations.

Core Features & Use Cases

  • Constructor injection rules and guidance for single/multiple constructors
  • Proper use of CDI scopes, scope mismatch prevention, and Instance<T> for optional dependencies
  • Producer methods, events/observers, and interceptors with ordering and qualifiers
  • Real-world scenarios in containerized Jakarta CDI apps (Quarkus/Java EE)

Quick Start

Create a Jakarta CDI project and apply the demonstrated patterns to your beans, producers, and event observers to bootstrap best practices.

Frequently Asked Questions about java-cdi

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement constructor injection correctly in Jakarta CDI?

Constructor injection in Jakarta CDI requires following specific rules for single and multiple constructors to ensure proper dependency resolution. This Skill enforces concrete constructor injection rules and documents requirements to prevent misconfigurations in containerized Java applications.

What is the best way to handle optional dependencies in CDI beans?

The best way to handle optional dependencies in CDI is using Instance<T> instead of direct injection. This Skill provides guidance on Instance<T> usage to safely resolve optional dependencies without deployment errors in Jakarta CDI projects.

How do I prevent CDI bean scope mismatch in Quarkus or Java EE?

Preventing CDI bean scope mismatch requires enforcing scope safety rules across your beans. This Skill covers proper CDI scope usage and mismatch prevention for real-world scenarios in containerized Jakarta CDI apps like Quarkus and Java EE.

Why do my CDI producer methods return null and how do I fix it?

CDI producer methods must enforce non-null returns to satisfy the container's dependency injection contract. This Skill enforces non-null producer requirements and provides guidance on implementing producer methods with qualifiers correctly.

How do I enforce deterministic interceptor ordering in Jakarta CDI?

Deterministic interceptor ordering in Jakarta CDI is achieved by applying specific ordering rules and qualifiers to interceptor bindings. This Skill documents and enforces deterministic interceptor ordering to ensure consistent behavior across real-world scenarios.

Can I use CDI events and observers with Quarkus?

Yes, you can use CDI events and observers in Quarkus since it supports Jakarta CDI natively. This Skill covers events, observers, and producer methods across real-world scenarios in containerized Jakarta CDI apps like Quarkus and Java EE.