Skip to content

Commit 7451118

Browse files
committed
Document support for @ManagedBean
Issue: SPR-14600
1 parent 7bb4ab6 commit 7451118

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/asciidoc/core-beans.adoc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5822,17 +5822,18 @@ you should use the `@Named` annotation as follows:
58225822

58235823

58245824
[[beans-named]]
5825-
=== @Named: a standard equivalent to the @Component annotation
5825+
=== @Named and @ManagedBean: standard equivalents to the @Component annotation
58265826

5827-
Instead of `@Component`, `@javax.inject.Named` may be used as follows:
5827+
Instead of `@Component`, `@javax.inject.Named` or `javax.annotation.ManagedBean` may be
5828+
used as follows:
58285829

58295830
[source,java,indent=0]
58305831
[subs="verbatim,quotes"]
58315832
----
58325833
import javax.inject.Inject;
58335834
import javax.inject.Named;
58345835
5835-
@Named("movieListener")
5836+
@Named("movieListener") // @ManagedBean("movieListener") could be used as well
58365837
public class SimpleMovieLister {
58375838
58385839
private MovieFinder movieFinder;
@@ -5869,8 +5870,8 @@ It is very common to use `@Component` without specifying a name for the componen
58695870
}
58705871
----
58715872

5872-
When using `@Named`, it is possible to use component scanning in the exact same way
5873-
as when using Spring annotations:
5873+
When using `@Named` or `@ManagedBean`, it is possible to use component scanning in the
5874+
exact same way as when using Spring annotations:
58745875

58755876
[source,java,indent=0]
58765877
[subs="verbatim,quotes"]
@@ -5884,8 +5885,9 @@ as when using Spring annotations:
58845885

58855886
[NOTE]
58865887
====
5887-
In contrast to `@Component`, the JSR-330 `@Named` annotation is not composable.
5888-
Please use Spring's stereotype model for building custom component annotations.
5888+
In contrast to `@Component`, the JSR-330 `@Named` and the JSR-250 `ManagedBean`
5889+
annotations are not composable. Please use Spring's stereotype model for building custom
5890+
component annotations.
58895891
====
58905892

58915893

@@ -5906,7 +5908,7 @@ features are not available as shown in the table below:
59065908
| `@Inject` has no 'required' attribute; can be used with Java 8's `Optional` instead.
59075909

59085910
| @Component
5909-
| @Named
5911+
| @Named / @ManagedBean
59105912
| JSR-330 does not provide a composable model, just a way to identify named components.
59115913

59125914
| @Scope("singleton")

src/asciidoc/testing.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ tests and can be used anywhere in the Spring Framework.
846846
* `@Autowired`
847847
* `@Qualifier`
848848
* `@Resource` (javax.annotation) _if JSR-250 is present_
849+
* `@ManagedBean` (javax.annotation) _if JSR-250 is present_
849850
* `@Inject` (javax.inject) _if JSR-330 is present_
850851
* `@Named` (javax.inject) _if JSR-330 is present_
851852
* `@PersistenceContext` (javax.persistence) _if JPA is present_

0 commit comments

Comments
 (0)