diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 71659344b..9823e8f64 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -107,6 +107,7 @@ Picocli 4.7.0 introduced a `sortSynopsis = false` attribute to let the synopsis * [#1625] DOC: Fix broken links after renaming default branch to `main` from `master`. Thanks to [Andreas Deininger](https://github.com/deining) for the pull request. * [#1628][#1630] DOC: Fix broken link in `picocli-codegen` `README`. Thanks to [Andreas Deininger](https://github.com/deining) for the pull request. * [#1627] DOC: User guide, chapter 3.2.3. Forcing Interactive Input: code sample: add Kotlin version. Thanks to [Andreas Deininger](https://github.com/deining) for the pull request. +* [#1650] DOC: User guide, Spring Boot section: add warning about dynamic proxies. Thanks to [Ernst Plüss](https://github.com/pluess) for raising this. * [#1581] BUILD: Fix dependabot config. * [#1613] DEP: The `picocli-groovy` module now declares `groovy-all` as dependency. * [#1604] DEP: Remove dependency on `slf4j` from `picocli-spring-boot-starter`. diff --git a/docs/index.adoc b/docs/index.adoc index 90737f32f..f7cdf441d 100644 --- a/docs/index.adoc +++ b/docs/index.adoc @@ -11748,6 +11748,17 @@ mvnw compile spring-boot:dev -Dspring-boot.run.arguments="--to hans@mustermann.d With all options and parameters specified, a mail is sent successfully. +[IMPORTANT] +==== +Depending on your configuration, Spring may use dynamic proxies for managed instances. +This is definitely the case when using features like https://docs.spring.io/spring-framework/docs/6.0.x/reference/html/data-access.html#tx-decl-explained[`@Transactional`], https://docs.spring.io/spring-framework/docs/6.0.x/reference/html/integration.html#cache[Caching] and Spring https://docs.spring.io/spring-framework/docs/6.0.x/reference/html/core.html#aop-understanding-aop-proxies[Aspect Oriented Programming] (AOP), but may happen in other configurations also. + +The safest thing to do in Spring 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. +==== + +The https://github.com/remkop/picocli/tree/main/picocli-spring-boot-starter[picocli-spring-boot-starter README] has another example of a picocli app integrated into Spring Boot. + [TIP] ==== It may be a good idea to define an option `--spring.config.location` in your command. @@ -11770,8 +11781,6 @@ Alternatively, you can define an <> field to cap ---- ==== -The https://github.com/remkop/picocli/tree/main/picocli-spring-boot-starter[picocli-spring-boot-starter README] has another example of a picocli app integrated into Spring Boot. - === Micronaut Example image:https://avatars.githubusercontent.com/u/36880643?s=200&v=4[Micronaut Logo] diff --git a/docs/index.html b/docs/index.html index ff9815d27..976459044 100644 --- a/docs/index.html +++ b/docs/index.html @@ -16574,6 +16574,28 @@

With all options and parameters specified, a mail is sent successfully.

+
+ + + + + +
+ + +
+

Depending on your configuration, Spring may use dynamic proxies for managed instances. +This is definitely the case when using features like @Transactional, Caching and Spring Aspect Oriented Programming (AOP), but may happen in other configurations also.

+
+
+

The safest thing to do in Spring 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.

+
+
+
+
+

The picocli-spring-boot-starter README has another example of a picocli app integrated into Spring Boot.

+
@@ -16606,9 +16628,6 @@

-
-

The picocli-spring-boot-starter README has another example of a picocli app integrated into Spring Boot.

-

22.3. Micronaut Example