<commit_before>[[devmode]]
== Development Mode

Weld comes with a special mode for application development. When enabled, certain built-in tools which facilitate the development of CDI applications, are available.

NOTE: The development mode should not be used in production as it may have negative impact on the performance of the application. Make sure to disable the development mode before deploying to production.

WARNING: Not all environments and containers may support the development mode and all tools. Check the <<devtools,tools>> details and the container documentation.

[[devmode-enable]]
=== How to enable the development mode

==== Web application

For a web application, set the Servlet initialization parameter `org.jboss.weld.development` to `true`:

[source.XML, xml]
-----------------------------------------------------------------------------------------------------------
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">

    <context-param>
        <param-name>org.jboss.weld.development</param-name>
        <param-value>true</param-value>
    </context-param>

</web-app>
-----------------------------------------------------------------------------------------------------------

NOTE: An integrator is allowed to specify an alternative way of enabling the development mode.

==== Weld SE

For a Java SE application, set the system property `org.jboss.weld.development` to `true`:

-----------------------------------------------------------------------------------------------------------
java -cp myCoolApp.jar -Dorg.jboss.weld.development=true com.foo.MyMain
-----------------------------------------------------------------------------------------------------------

or use the `Weld.property()` method:

[source.JAVA, java]
-----------------------------------------------------------------
org.jboss.weld.environment.se.Weld;

public static void main(String[] args) {
   Weld weld = new Weld().property("org.jboss.weld.development", true);
   try (WeldContainer container = weld.initialize()) {
      ...
   }
}
-----------------------------------------------------------------

==== Is The Development Mode Enabled?

You should see the following log message during initialization of your application:

-----------------------------------------------------------------------------------------------------------
=====================================
 Weld Development Mode: ENABLED
 ------------------------------------
 Disable this mode in production - it may have negative impact on performance and/or represent a potential security risk
=====================================
-----------------------------------------------------------------------------------------------------------

[[devtools]]
=== Development Tools

[[probe]]
==== Probe

This tool allows to inspect the application CDI components at runtime. See also the http://probe-weld.itos.redhat.com/weld-numberguess/weld-probe[demo application hosted on OpenShift].

JSON data are available through the REST API, eventually (if <<config-dev-mode,JMX support is enabled>>) through the MXBean of name `org.jboss.weld.probe:type=JsonData,context=ID` where ID should be replaced with an idenfitier of an application.

However, a default UI - HTML client (single-page application) is only available in a web application at `{webappContextPath}/weld-probe`, e.g. `http://localhost:8080/weld-numberguess/weld-probe`.

Right now, the integration is provided for WildFly 10, Tomcat and Jetty (Weld Servlet) and Weld SE.

TIP: There are some configuration properties which allow to tune or disable Probe features, e.g. to restrict the set of components which will be monitored. See also <<config-dev-mode>>.<commit_msg>WELD-2431 Update development tool docs<commit_after>[[devmode]]
== Development Mode

Weld comes with a special mode for application development. When enabled, certain built-in tools which facilitate the development of CDI applications, are available.

NOTE: The development mode should not be used in production as it may have negative impact on the performance of the application. Make sure to disable the development mode before deploying to production.

WARNING: Not all environments and containers may support the development mode and all tools. Check the <<devtools,tools>> details and the container documentation.

[[devmode-enable]]
=== How to enable the development mode

==== Web application

For a web application, set the Servlet initialization parameter `org.jboss.weld.development` to `true`:

[source.XML, xml]
-----------------------------------------------------------------------------------------------------------
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">

    <context-param>
        <param-name>org.jboss.weld.development</param-name>
        <param-value>true</param-value>
    </context-param>

</web-app>
-----------------------------------------------------------------------------------------------------------

NOTE: An integrator is allowed to specify an alternative way of enabling the development mode. See for example https://docs.jboss.org/author/display/WFLY/CDI+Reference#CDIReference-Developmentmode[WildFly Documentation].

==== Weld SE

For a Java SE application, set the system property `org.jboss.weld.development` to `true`:

-----------------------------------------------------------------------------------------------------------
java -cp myCoolApp.jar -Dorg.jboss.weld.development=true com.foo.MyMain
-----------------------------------------------------------------------------------------------------------

or use the `Weld.enableDevMode()` method:

[source.JAVA, java]
-----------------------------------------------------------------
org.jboss.weld.environment.se.Weld;

public static void main(String[] args) {
   try (WeldContainer container = new Weld().enableDevMode().initialize()) {
      ...
   }
}
-----------------------------------------------------------------

==== Is The Development Mode Enabled?

You should see the following log message during initialization of your application:

-----------------------------------------------------------------------------------------------------------
=====================================
 Weld Development Mode: ENABLED
 ------------------------------------
 Disable this mode in production - it may have negative impact on performance and/or represent a potential security risk
=====================================
-----------------------------------------------------------------------------------------------------------

[[devtools]]
=== Development Tools

[[probe]]
==== Probe

This tool allows you to inspect the application CDI components at runtime.
There is a default UI - HTML client (single-page application), which is only available in web applications.
Just point your browser to `protocol://host:port/webappContextPath/weld-probe`, e.g. `http://localhost:8080/weld-numberguess/weld-probe`.
However, it's also posible to obtain the JSON data through the REST API, eventually (if <<config-dev-mode,JMX support is enabled>>) through the MXBean of name `org.jboss.weld.probe:type=JsonData,context=ID` where ID should be replaced with an idenfitier of an application.
Right now, Probe integration is provided for WildFly, Tomcat and Jetty (Weld Servlet), and Weld SE.

TIP: There are some configuration properties which allow to tune or disable Probe features, e.g. to restrict the set of components which will be monitored. See also <<config-dev-mode>>.
{'fraction_non_alphanumeric': 0.3023463402193318, 'fraction_numerical': 0.00408059168579444, 'mean_word_length': 1.8855776306107432, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 18}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4227039', 'n_tokens_mistral': 1836, 'n_tokens_neox': 1751, 'n_words': 664}