Skip to content

Commit

Permalink
add BeanConfigurator.priority
Browse files Browse the repository at this point in the history
This is to allow setting a priority for synthetic beans created
using `BeanConfigurator`.

I briefly considered if `priority` should be added to
`BeanAttributesConfigurator` as well, but that would have
a ripple effect. It also doesn't reflect the present reality.
A custom `Bean` implementation can be added a priority
by implementing the `Prioritized` interface. Adding only
`BeanConfigurator.priority` is a perfect mirror of that
in the configurator API.
  • Loading branch information
Ladicek committed Sep 22, 2021
1 parent 8886ed3 commit 7da45de
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,20 @@ public interface BeanConfigurator<T> {
*/
BeanConfigurator<T> alternative(boolean value);

/**
* Set the priority of the configured bean.
* By default, the configured bean does not have a priority.
* <p>
* This is equivalent to putting the {@link jakarta.annotation.Priority Priority}
* annotation to an actual bean class or making a custom
* {@link jakarta.enterprise.inject.spi.Bean Bean} class implement
* {@link jakarta.enterprise.inject.spi.Prioritized Prioritized}.
* <p>
* This method has no effect if the configured bean is not an alternative.
*
* @param priority the priority value
* @return self
*/
BeanConfigurator<T> priority(int priority);

}

0 comments on commit 7da45de

Please sign in to comment.