Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Injection vs. get bean via application context

843844Sep 25 2007 — edited Sep 26 2007
Hi all,

I'm quite new to JSF and Spring and theres one question that bothers me. I use JSF together with Spring and all the managed beans are created via the spring framework.

It ist possible to inject the spring beans (dao) into the managed beans but you can also access the beans via:

ApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
ctx.getBean(....

Which is the best method and what are the advantages/disadvatages of each method.

Regards
Matt
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 24 2007
Added on Sep 25 2007
3 comments
677 views