Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how conflicting default scopes and priorities on stereotypes work #557

Merged
merged 1 commit into from
Nov 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions spec/src/main/asciidoc/core/definition.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ The _default scope_ for a bean which does not explicitly declare a scope depends

* If the bean does not declare any stereotype with a declared default scope, the default scope for the bean is `@Dependent`.
* If all stereotypes declared by the bean that have some declared default scope have the same default scope, then that scope is the default scope for the bean.
* If there are two different stereotypes declared by the bean that declare different default scopes, then there is no default scope and the bean must explicitly declare a scope.
* If there are two different stereotypes present on the bean, directly, indirectly, or transitively, that declare different default scopes, then there is no default scope and the bean must explicitly declare a scope.
If it does not explicitly declare a scope, the container automatically detects the problem and treats it as a definition error.


Expand Down Expand Up @@ -841,7 +841,8 @@ public @interface Mock {}

A stereotype may declare a `@Priority` annotation which functions as a means of enabling and ordering affected beans.

If a bean declares two different stereotypes that declare different priority values, the bean must explicitly declare a `@Priority` annotation. If the bean does not explicitly declare priority, the container automatically detects the problem and treats it as a definition error.
If there are two different stereotypes present on a bean, directly, indirectly, or transitively, that declare different priority values, then the bean must explicitly declare a `@Priority` annotation.
If the bean does not explicitly declare priority, the container automatically detects the problem and treats it as a definition error.

If a bean explicitly declares priority, any priority values declared by stereotypes are ignored.

Expand Down