From 3fc13032186331dc64070efdd6c8a33bc4c78aef Mon Sep 17 00:00:00 2001 From: Matej Novotny Date: Tue, 23 Jun 2026 15:22:10 +0200 Subject: [PATCH] Fix outdated references in documentation Update context propagation example, fix `master` to `main` link, and update Jetty section with `ee10-cdi`/`ee11-cdi` modules. --- README.md | 2 +- docs/reference/src/main/asciidoc/contexts.asciidoc | 14 ++++++++------ .../src/main/asciidoc/environments.asciidoc | 9 +++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 77a690970e7..7304316cf0c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ To build Weld simply run Upgrading Weld in WildFly ------------------------- -Firstly, set the `JBOSS_HOME` environment property to point to your WildFly installation which already contains Weld 3 in older version: +Firstly, set the `JBOSS_HOME` environment property to point to your WildFly installation: > $ export JBOSS_HOME=/opt/wildfly diff --git a/docs/reference/src/main/asciidoc/contexts.asciidoc b/docs/reference/src/main/asciidoc/contexts.asciidoc index 838fb5df80e..d95f13718d0 100644 --- a/docs/reference/src/main/asciidoc/contexts.asciidoc +++ b/docs/reference/src/main/asciidoc/contexts.asciidoc @@ -325,7 +325,7 @@ public interface WeldManager extends BeanManager { ==== Example of context propagation There is a concise example in a form of a test in our code showing how to propagate all built-in contexts. -This doc only contains an excerpt from it, you can look link:https://github.com/weld/core/blob/master/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/propagation[here] to get the full picture. +This doc only contains an excerpt from it, you can look link:https://github.com/weld/core/blob/main/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/propagation[here] to get the full picture. Following code shows a service that provides an extra thread onto which you offload a `Callable` that uses beans from currently active context. The service activates contexts, propagates state from original thread, executes task and cleans up. @@ -340,7 +340,6 @@ public class ContextPropagationService { public static Future propagateContextsAndSubmitTask(Callable task) { // gather all the contexts we want to propagate and the instances in them Map, Collection>> scopeToContextualInstances = new HashMap<>(); - WeldManager get = CDI.current().select(WeldManager.class).get(); for (WeldAlterableContext context : CDI.current().select(WeldManager.class).get().getActiveWeldAlterableContexts()) { scopeToContextualInstances.put(context.getScope(), context.getAllContextualInstances()); } @@ -349,11 +348,14 @@ public class ContextPropagationService { @Override public T call() throws Exception { - // Get WeldManager,get instances of @Bound contexts for request, session and conversation scopes + // Get WeldManager and @Bound context instances for request, session and conversation scopes WeldManager weldManager = CDI.current().select(WeldManager.class).get(); - BoundRequestContext requestContext = weldManager.instance().select(BoundRequestContext.class, BoundLiteral.INSTANCE).get(); - BoundSessionContext sessionContext = weldManager.instance().select(BoundSessionContext.class, BoundLiteral.INSTANCE).get(); - BoundConversationContext conversationContext = weldManager.instance().select(BoundConversationContext.class, BoundLiteral.INSTANCE).get(); + BoundRequestContext requestContext = weldManager.instance() + .select(BoundRequestContext.class, BoundLiteral.INSTANCE).get(); + BoundSessionContext sessionContext = weldManager.instance() + .select(BoundSessionContext.class, BoundLiteral.INSTANCE).get(); + BoundConversationContext conversationContext = weldManager.instance() + .select(BoundConversationContext.class, BoundLiteral.INSTANCE).get(); // We will be using bound contexts, prepare backing structures for contexts Map sessionMap = new HashMap<>(); diff --git a/docs/reference/src/main/asciidoc/environments.asciidoc b/docs/reference/src/main/asciidoc/environments.asciidoc index 101c0cd3e3b..f7ce57a6ad2 100644 --- a/docs/reference/src/main/asciidoc/environments.asciidoc +++ b/docs/reference/src/main/asciidoc/environments.asciidoc @@ -183,15 +183,16 @@ Jetty 12 and newer are supported. Context activation/deactivation and dependency No further configuration is needed when starting Jetty as an embedded webapp server from within another Java program. However, if you’re using a Jetty standalone instance, there is one more configuration step that is required. -===== Jetty `ee10-cdi` Module +===== Jetty CDI Module -The Weld/Jetty integration uses the Jetty `ee10-cdi` module. -To activate this module in Jetty, the argument `--add-modules=ee10-cdi` needs to be added to the +The Weld/Jetty integration uses a Jetty CDI module. +The module name depends on which Jakarta EE version you target: `ee10-cdi` for Jakarta EE 10 (Jetty 12.0.x) or `ee11-cdi` for Jakarta EE 11 (Jetty 12.1.x). +To activate this module in Jetty, the argument `--add-modules=ee10-cdi` (or `ee11-cdi`) needs to be added to the command line, which can be done for a standard distribution by running the commands: ------------------------- cd $JETTY_BASE -java -jar $JETTY_HOME/start.jar --add-modules=ee10-cdi +java -jar $JETTY_HOME/start.jar --add-modules=ee11-cdi ------------------------- ==== Undertow