Skip to content

Commit

Permalink
document generic synthetic bean creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Loic Hermann authored and Loic Hermann committed Sep 2, 2024
1 parent 644cc9c commit f33564e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/src/main/asciidoc/writing-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,25 @@ SyntheticBeanBuildItem syntheticBean(TestRecorder recorder) {
----
<1> The "real" components can inject the `TestContext` directly.


It is also possible to create a generic synthetic bean `Foo<Bar>`.

[source%nowrap,java]
----
@BuildStep
@Record(STATIC_INIT)
SyntheticBeanBuildItem syntheticBean(TestRecorder recorder) {
return SyntheticBeanBuildItem.configure(Foo.class)
.types(ParameterizedType.create(Foo.class, ClassType.create(Bar.class)))) <1>
.scope(Singleton.class)
.runtimeValue(recorder.createFooBar())
.done();
}
----

<1> types must be used to specify the generic type.


=== Some types of extensions

There exist multiple stereotypes of extension, let's list a few.
Expand Down

0 comments on commit f33564e

Please sign in to comment.