diff --git a/docs/index.adoc b/docs/index.adoc index 2564c1371..eba28c9d3 100644 --- a/docs/index.adoc +++ b/docs/index.adoc @@ -12409,7 +12409,7 @@ public class CDIFactory implements IFactory { if (instance.isResolvable()) { return instance.get(); } - return defaultFactory.create(cls); + return fallbackFactory.create(cls); } } ---- @@ -12421,9 +12421,13 @@ How to use the above factory depends on the specific container, but in general i @Command(name = "cdi-app", mixinStandardHelpOptions = true) class MyCDIApp implements Runnable { - @Option(names = {"-x", "--option"}, description = "example option") boolean flag; + @Option(names = {"-x", "--option"}, description = "example option") + public void setFlag(boolean flag) { + this.flag = flag; + } + @Override public void run() { // business logic @@ -12436,6 +12440,14 @@ class MyCDIApp implements Runnable { } ---- +[IMPORTANT] +==== +Depending on your configuration, CDI may use dynamic proxies for managed instances. + +The safest thing to do in CDI applications is to use public <> for picocli's `@Option` and `@Parameters`, `@Spec`, and other annotations. +Using picocli annotations on fields or on non-public methods may result in picocli-injected values not being available in the proxied instance. +==== + == Java 9 JPMS Modules The main `picocli-${version}.jar` is a JPMS module named `info.picocli`. diff --git a/docs/index.html b/docs/index.html index 04d2cbf0b..62b5f5478 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1709,81 +1709,81 @@ }); }); - - - + + + @@ -17486,7 +17486,7 @@

22.5. C if (instance.isResolvable()) { return instance.get(); } - return defaultFactory.create(cls); + return fallbackFactory.create(cls); } } @@ -17499,9 +17499,13 @@

22.5. C
@Command(name = "cdi-app", mixinStandardHelpOptions = true)
 class MyCDIApp implements Runnable {
 
-    @Option(names = {"-x", "--option"}, description = "example option")
     boolean flag;
 
+    @Option(names = {"-x", "--option"}, description = "example option")
+    public void setFlag(boolean flag) {
+        this.flag = flag;
+    }
+
     @Override
     public void run() {
         // business logic
@@ -17514,6 +17518,24 @@ 

22.5. C }

+
+ + + + + +
+ + +
+

Depending on your configuration, CDI may use dynamic proxies for managed instances.

+
+
+

The safest thing to do in CDI applications is to use public annotated setter methods for picocli’s @Option and @Parameters, @Spec, and other annotations. +Using picocli annotations on fields or on non-public methods may result in picocli-injected values not being available in the proxied instance.

+
+
+
@@ -19140,4 +19162,4 @@

37.2. Source

handleTocOnResize(); - \ No newline at end of file +