Debugging Jakarta CDI Applications: A Quick Intro to Payara Server’s CDI Tools

Community

Payara Server offers integrated tools that streamline your development experience when working with Jakarta CDI (Contexts and Dependency Injection) in your applications. In this post, we’ll take a look at the CDI Development Mode available in Payara Server and the CDI Probe it offers.

What is CDI Development Mode?

CDI Development Mode provides key tools and features that help you simplify the process of developing, inspecting and debugging CDI-backed applications. It allows for a much smoother development workflow.

The CDI Probe

Think of the CDI Probe as an x-ray machine. It gives you in-depth visibility into the CDI beans in your applications at runtime. You can monitor their behaviour, inspect their properties and diagnose potential issues.

Enabling CDI Development Mode

There are three ways to activate CDI Development Mode for your applications:

  • During Deployment: When deploying your application using either the asadmin CLI or the Admin Console, enable it using a checkbox or a property.
  • Web Application Configuration: Embed a context parameter within your application’s web.xml file to automatically enable CDI Development Mode.
  • Global Server Setting: Set a system property (org.jboss.weld.development=true) to enable CDI Development Mode for all applications deployed to your Payara Server.

Important: If you enable CDI Development Mode using multiple methods, the options that enable it take precedence and cannot be overridden.

Accessing the CDI Probe

Once CDI Development Mode is active, you have various ways to use the CDI Probe:

  • REST API: Interact with the CDI Probe programmatically through its REST interface (for data integration or automation).
  • Web Application: Access the intuitive CDI Probe web application directly within your browser or via a convenient link from the Payara Server’s Admin Console.
  • Web Page Toolbar: If your application has web pages, CDI Development Mode adds a toolbar that provides swift access to the CDI Probe and bean invocation details.

What the CDI Probe Can Do

The CDI Probe provides a glimpse into the intricate workings of your Jakarta CDI beans, giving you detailed debugging capabilities. It allows you to:

  • Break down Bean Architecture: Visualise the dependencies between your CDI beans.  This helps simplify complex architectures, making them easier to maintain and modify. It’s particularly useful for onboarding new developers or when working with legacy code.
  • Dig into Bean Data: Inspect the current state of your beans, including properties, fields and their values. This allows for real-time debugging – you can watch variables change in response to user inputs or system events, showing the true flow of data within your application.
  • Track Event Sequences: Observe CDI bean events as they fire in real-time, providing a detailed timeline of bean interactions within your application.  Pinpoint the exact triggers leading to specific consequences, enabling you to debug complex event-driven systems or verify that your logic behaves as intended.
  • Unravel Execution Paths:  Step through the chain of bean invocations as your application executes. This offers a powerful way to identify performance issues, find unexpected method calls or simply understand the intricate flow of control.

Summary

In essence, the CDI Probe allows you to proactively debug, maintain and optimise your Jakarta EE CDI applications in a simplified and intuitive way. Take a look at the detailed documentation page and download a copy of Payara Server Community today to get started using the CDI Tools!

{{cta(‘b2e4c2b6-f33a-4ae4-9290-f1cf476f445a’)}}

Branding Tagline_Hubspot Banner-1

 

Comments (0)

Post a comment

Your email address will not be published. Required fields are marked *

Payara needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, please review our Legal & Privacy Policy.

Related Posts

payara qube logo 5 minutes
Payara

Payara Cloud Is Now part of Payara Qube family of Unified Platforms for Enterprise Java

Payara Cloud is becoming part of Payara Qube family of Java application deployment runtimes. This move reflects how the […]

Payara promotional graphic showing transition from Spring to Jakarta EE, including technology logos, a code icon and arrows leading from Spring to Jakarta EE. 6 minutes
Jakarta EE

From Spring Boot To Jakarta EE 11: How Payara Starter Eases The Transition

If you’ve been living in the Spring ecosystem, you’re used to fast project setup. Spring Initializr gives you a […]

Promotional graphic for a podcast episode titled “Why Open Source is the Future of Business Innovation - A conversation with Arun Gupta”. The podcast is hosted by Payara Community. The right side features a photo of the speaker, Arun Gupta, labeled as a “VP, Developer Experience at JetBrains”. The design uses dark blue and teal backgrounds with coral and fish illustrations. 2 minutes
Community

Payara Podcast – Why Open Source is the Future of Business Innovation – A Conversation with Arun Gupta

Open source is no longer a developer-only concern — it’s at the heart of how modern businesses innovate, build […]