From 0e2600501a0453ffcd3f7fc0e787e1de8857eb20 Mon Sep 17 00:00:00 2001 From: kicmeri <58749831+kicmeri@users.noreply.github.com> Date: Wed, 27 Jul 2022 11:20:16 +0200 Subject: [PATCH 1/2] Update debugging.adoc Proposing the change as I was unable to make it work in test method or with `@BeforeAll`. Hoping it may save time for others. --- docs/asciidoc/debugging.adoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/asciidoc/debugging.adoc b/docs/asciidoc/debugging.adoc index fc040cc7b9..2b70b60dc0 100644 --- a/docs/asciidoc/debugging.adoc +++ b/docs/asciidoc/debugging.adoc @@ -448,8 +448,10 @@ You may also re-process existing classes if you cannot run the init eagerly (e.g ==== [source,java] ---- -ReactorDebugAgent.init(); -ReactorDebugAgent.processExistingClasses(); +static { + ReactorDebugAgent.init(); + ReactorDebugAgent.processExistingClasses(); +} ---- ==== From 31e8db2c3e17ec387723c896ccf5844990c2cfa9 Mon Sep 17 00:00:00 2001 From: kicmeri <58749831+kicmeri@users.noreply.github.com> Date: Thu, 28 Jul 2022 08:32:55 +0200 Subject: [PATCH 2/2] Clarify how to use processExistingClasses in debugging.adoc Improve the hint for alternative setups --- docs/asciidoc/debugging.adoc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/asciidoc/debugging.adoc b/docs/asciidoc/debugging.adoc index 2b70b60dc0..0fbaee1be7 100644 --- a/docs/asciidoc/debugging.adoc +++ b/docs/asciidoc/debugging.adoc @@ -433,7 +433,7 @@ ReactorDebugAgent.init(); ==== TIP: Since the implementation will instrument your classes when they are loaded, -the best place to put it is before everything else in your main(String[]) methood: +the best place to put it is before everything else in your main(String[]) method: ==== [source,java] ---- @@ -444,14 +444,12 @@ public static void main(String[] args) { ---- ==== -You may also re-process existing classes if you cannot run the init eagerly (e.g. in the tests): +You may also re-process existing classes with `processExistingClasses()` if you cannot run the init eagerly. For example, in https://junit.org/junit5/docs/current/user-guide/#launcher-api-listeners-custom[JUnit5 tests from a `TestExecutionListener`] or even in the class `static` initializer block: ==== [source,java] ---- -static { - ReactorDebugAgent.init(); - ReactorDebugAgent.processExistingClasses(); -} +ReactorDebugAgent.init(); +ReactorDebugAgent.processExistingClasses(); ---- ====