Skip to content

Commit

Permalink
Clarify that WeldInitiator.from() and WeldInitiator.of() should use t…
Browse files Browse the repository at this point in the history
…he same variable scope
  • Loading branch information
manovotn committed Jan 30, 2024
1 parent 3b6bc06 commit 7c79b90
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions junit5/src/main/java/org/jboss/weld/junit5/WeldInitiator.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ public static WeldInitiator of(Class<?>... beanClasses) {

/**
* The container is configured through a provided {@link Weld} instance.
* <p>
* Provided instance of {@link Weld} should be kept in the same scope as the resulting {@link WeldInitiator}.
* I.e. if {@link Weld} instance is kept in a static field, so should be the resulting {@link WeldInitiator}.
* Failing to uphold this can lead to repetitive configuration of the same {@link Weld} instance which in turn results in
* unexpected container setup/behavior.
*
* @param weld
* @param weld instance of {@link Weld} used to create {@link WeldInitiator}
* @return a new WeldInitiator instance
*/
public static WeldInitiator of(Weld weld) {
Expand Down Expand Up @@ -120,8 +125,13 @@ public static Builder from(Class<?>... beanClasses) {

/**
* Create a builder instance.
* <p>
* Provided instance of {@link Weld} should be kept in the same scope as the resulting {@link WeldInitiator}.
* I.e. if {@link Weld} instance is kept in a static field, so should be the resulting {@link WeldInitiator}.
* Failing to uphold this can lead to repetitive configuration of the same {@link Weld} instance which in turn results in
* unexpected container setup/behavior.
*
* @param weld
* @param weld instance of {@link Weld} used as a basis for this {@link WeldInitiator.Builder}
* @return a builder instance
* @see #of(Weld)
*/
Expand Down

0 comments on commit 7c79b90

Please sign in to comment.