简体   繁体   中英

JSF beans instantion: Are only the beans referenced in the view instantiated?

I'm guessing that if I have 6 requestscoped beans, only those referenced by the current view ( for instance by using #{foo.bar}) are instantiated. Is that assumption correct? In that case the only bean created would be foo, and not foo2, foo3, etc that are also requestscoped or viewscoped, etc.

Does this happen to both CDI's @Named and jSF's @ManagedBean beans?

Yes, it is correct.

You can test that by logging a message / adding a breakpoint in the constructor of all beans.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM